diff --git a/.github/workflows/bld.yml b/.github/workflows/bld.yml
index f736169..c0ba763 100644
--- a/.github/workflows/bld.yml
+++ b/.github/workflows/bld.yml
@@ -12,12 +12,12 @@ jobs:
steps:
- name: Checkout source repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK ${{ matrix.java-version }}
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml
index f6122cd..bf43624 100644
--- a/.github/workflows/pages.yml
+++ b/.github/workflows/pages.yml
@@ -30,14 +30,14 @@ jobs:
steps:
- name: Checkout source repository
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
- distribution: 'zulu'
+ distribution: "zulu"
java-version: 17
- name: Build Javadocs
@@ -50,8 +50,8 @@ jobs:
uses: actions/upload-pages-artifact@v1
with:
# Upload generated Javadocs repository
- path: 'build/javadoc/'
+ path: "build/javadoc/"
- name: Deploy to GitHub Pages
id: deployment
- uses: actions/deploy-pages@v1
\ No newline at end of file
+ uses: actions/deploy-pages@v1
diff --git a/README.md b/README.md
index 5c547e3..66fd65a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
# [bld](https://rife2.com/bld) Extension to Run Tests with [TestNG](https://testng.org/)
-
[](https://opensource.org/licenses/Apache-2.0)
[](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
[](https://rife2.com/bld)
@@ -13,29 +12,11 @@ To install, please refer to the [extensions documentation](https://github.com/ri
To run the tests with TestNG, add the following to your build file:
```java
-@BuildCommand(summary = "Tests the project with TestNG")
-public void testng() throws Exception {
- new TestNgOperation()
- .fromProject(this)
- .packages("com.example")
- .execute();
-}
-```
-
-```console
-./bld compile testng
-```
-
-You could also override the default `test` command:
-
-```java
-@BuildCommand(summary = "Tests the project with TestNG")
-public void test throws Exception {
- new TestNgOperation()
- .fromProject(this)
- .suites("src/test/resources/testng.xml")
- .verbose(2)
- .execute();
+@Override
+public TestOperation, ?> testOperation() {
+ return new TestNgOperation()
+ .fromProject(this)
+ .packages("com.example");
}
```
diff --git a/config/pmd.xml b/config/pmd.xml
index 1039e40..3d3203c 100644
--- a/config/pmd.xml
+++ b/config/pmd.xml
@@ -24,8 +24,8 @@
-
+
@@ -35,8 +35,9 @@
-
+
+
@@ -52,8 +53,6 @@
-
-
@@ -107,4 +106,4 @@
-
\ No newline at end of file
+
diff --git a/examples/README.md b/examples/README.md
index 8fdec70..696fcb2 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -3,3 +3,9 @@ Compile and Run Tests with TestNG
```console
./bld compile test
```
+
+Compile and Generate JaCoCo Reports
+
+```console
+./bld compile jacoco
+```
diff --git a/examples/lib/bld/bld-wrapper.properties b/examples/lib/bld/bld-wrapper.properties
index dc50e13..d424f97 100644
--- a/examples/lib/bld/bld-wrapper.properties
+++ b/examples/lib/bld/bld-wrapper.properties
@@ -1,6 +1,7 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extensions=com.uwyn.rife2:bld-testng:0.9.4
+bld.extensions=com.uwyn.rife2:bld-testng:0.9.5
+bld.extension.jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.5
bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
diff --git a/examples/src/bld/java/com/example/ExamplesBuild.java b/examples/src/bld/java/com/example/ExamplesBuild.java
index ab35ed3..a296562 100644
--- a/examples/src/bld/java/com/example/ExamplesBuild.java
+++ b/examples/src/bld/java/com/example/ExamplesBuild.java
@@ -2,8 +2,11 @@ package com.example;
import rife.bld.BaseProject;
import rife.bld.BuildCommand;
+import rife.bld.extension.JacocoReportOperation;
import rife.bld.extension.TestNgOperation;
+import rife.bld.operations.TestOperation;
+import java.io.IOException;
import java.util.List;
import static rife.bld.dependencies.Repository.MAVEN_CENTRAL;
@@ -13,20 +16,29 @@ import static rife.bld.dependencies.Scope.test;
* Example build.
*
*
- * - ./bld compile test
+ * - {@code ./bld compile test}
+ * - {@code ./bld compile jacoco}
*
*/
public class ExamplesBuild extends BaseProject {
+ @Override
+ public TestOperation, ?> testOperation() {
+ return new TestNgOperation()
+ .fromProject(this)
+ .packages("com.example");
+ }
+
public ExamplesBuild() {
pkg = "com.example";
name = "Examples";
version = version(0, 1, 0);
+ javaRelease = 17;
downloadSources = true;
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL);
-
+
scope(test).include(dependency("org.testng", "testng", version(7, 9, 0)));
}
@@ -34,11 +46,10 @@ public class ExamplesBuild extends BaseProject {
new ExamplesBuild().start(args);
}
- @BuildCommand(summary = "Tests the project with TestNG")
- public void test() throws Exception {
- new TestNgOperation()
+ @BuildCommand(summary = "Generates Jacoco Reports")
+ public void jacoco() throws IOException {
+ new JacocoReportOperation()
.fromProject(this)
- .packages("com.example")
.execute();
}
}
diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties
index ab13047..d80f091 100644
--- a/lib/bld/bld-wrapper.properties
+++ b/lib/bld/bld-wrapper.properties
@@ -1,6 +1,6 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
-bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.7
+bld.extension-pmd=com.uwyn.rife2:bld-pmd:0.9.8
bld.repositories=MAVEN_CENTRAL,MAVEN_LOCAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation=
bld.sourceDirectories=
diff --git a/src/bld/java/rife/bld/extension/TestNgOperationBuild.java b/src/bld/java/rife/bld/extension/TestNgOperationBuild.java
index fbcc48b..68b3d6c 100644
--- a/src/bld/java/rife/bld/extension/TestNgOperationBuild.java
+++ b/src/bld/java/rife/bld/extension/TestNgOperationBuild.java
@@ -34,7 +34,7 @@ public class TestNgOperationBuild extends Project {
public TestNgOperationBuild() {
pkg = "rife.bld.extension";
name = "bld-testng";
- version = version(0, 9, 4);
+ version = version(0, 9, 5);
javaRelease = 17;
downloadSources = true;
@@ -76,7 +76,7 @@ public class TestNgOperationBuild extends Project {
.license(
new PublishLicense()
.name("The Apache License, Version 2.0")
- .url("http://www.apache.org/licenses/LICENSE-2.0.txt")
+ .url("https://www.apache.org/licenses/LICENSE-2.0.txt")
)
.scm(
new PublishScm()
diff --git a/src/main/java/rife/bld/extension/TestNgOperation.java b/src/main/java/rife/bld/extension/TestNgOperation.java
index 33c15d5..2fef66a 100644
--- a/src/main/java/rife/bld/extension/TestNgOperation.java
+++ b/src/main/java/rife/bld/extension/TestNgOperation.java
@@ -17,7 +17,7 @@
package rife.bld.extension;
import rife.bld.BaseProject;
-import rife.bld.operations.AbstractProcessOperation;
+import rife.bld.operations.TestOperation;
import java.io.File;
import java.io.IOException;
@@ -37,7 +37,7 @@ import java.util.stream.Collectors;
* @since 1.0
*/
@SuppressWarnings("PMD.TestClassWithoutTestCases")
-public class TestNgOperation extends AbstractProcessOperation {
+public class TestNgOperation extends TestOperation> {
private static final Logger LOGGER = Logger.getLogger(TestNgOperation.class.getName());
/**
* The run options.
@@ -151,11 +151,12 @@ public class TestNgOperation extends AbstractProcessOperation {
}
if (!options.containsKey("-d")) {
- options.put("d", Path.of(project.buildDirectory().getPath(), "test-output").toString());
+ options.put("-d", Path.of(project.buildDirectory().getPath(), "test-output").toString());
}
final List args = new ArrayList<>();
args.add(javaTool());
+ args.addAll(this.javaOptions());
args.add("-cp");
if (testClasspath.isEmpty()) {