diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 4745e94..f656651 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -1,5 +1,6 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= +bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.5 bld.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES bld.version=2.2.1 diff --git a/src/bld/java/rife/bld/extension/PmdOperationBuild.java b/src/bld/java/rife/bld/extension/PmdOperationBuild.java index cbaa6ba..dcd6e0b 100644 --- a/src/bld/java/rife/bld/extension/PmdOperationBuild.java +++ b/src/bld/java/rife/bld/extension/PmdOperationBuild.java @@ -21,6 +21,9 @@ import rife.bld.publish.PublishDeveloper; import rife.bld.publish.PublishLicense; import rife.bld.publish.PublishScm; +import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.List; import static rife.bld.dependencies.Repository.*; @@ -31,13 +34,13 @@ public class PmdOperationBuild extends Project { public PmdOperationBuild() { pkg = "rife.bld.extension"; name = "bld-pmd"; - version = version(1, 2, 3); + version = version(1, 2, 4, "SNAPSHOT"); javaRelease = 17; downloadSources = true; autoDownloadPurge = true; - + repositories = List.of(MAVEN_LOCAL, MAVEN_CENTRAL, RIFE2_RELEASES, RIFE2_SNAPSHOTS); var pmd = version(7, 13, 0); @@ -88,4 +91,35 @@ public class PmdOperationBuild extends Project { public static void main(String[] args) { new PmdOperationBuild().start(args); } + + @Override + public void test() throws Exception { + var testResultsDir = "build/test-results/test/"; + + var op = testOperation().fromProject(this); + op.testToolOptions().reportsDir(new File(testResultsDir)); + + Exception ex = null; + try { + op.execute(); + } catch (Exception e) { + ex = e; + } + + var xunitViewer = new File("/usr/bin/xunit-viewer"); + if (xunitViewer.exists() && xunitViewer.canExecute()) { + var reportsDir = "build/reports/tests/test/"; + + Files.createDirectories(Path.of(reportsDir)); + + new ExecOperation() + .fromProject(this) + .command(xunitViewer.getPath(), "-r", testResultsDir, "-o", reportsDir + "index.html") + .execute(); + } + + if (ex != null) { + throw ex; + } + } }