diff --git a/lib/bld/bld-wrapper.properties b/lib/bld/bld-wrapper.properties index 8b96558..2ff628d 100644 --- a/lib/bld/bld-wrapper.properties +++ b/lib/bld/bld-wrapper.properties @@ -2,6 +2,7 @@ bld.downloadExtensionJavadoc=false bld.downloadExtensionSources=true bld.downloadLocation= bld.extension-detekt=com.uwyn.rife2:bld-detekt:0.9.10-SNAPSHOT +bld.extension-exec=com.uwyn.rife2:bld-exec:1.0.5 bld.extension-gv=com.uwyn.rife2:bld-generated-version:1.0.1 bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.10 bld.extension-kotlin=com.uwyn.rife2:bld-kotlin:1.1.0-SNAPSHOT diff --git a/src/bld/java/net/thauvin/erik/MobibotBuild.java b/src/bld/java/net/thauvin/erik/MobibotBuild.java index 3792fa1..45f0c6b 100644 --- a/src/bld/java/net/thauvin/erik/MobibotBuild.java +++ b/src/bld/java/net/thauvin/erik/MobibotBuild.java @@ -34,10 +34,7 @@ package net.thauvin.erik; import rife.bld.BuildCommand; import rife.bld.Project; import rife.bld.dependencies.Repository; -import rife.bld.extension.CompileKotlinOperation; -import rife.bld.extension.DetektOperation; -import rife.bld.extension.GeneratedVersionOperation; -import rife.bld.extension.JacocoReportOperation; +import rife.bld.extension.*; import rife.bld.operations.exceptions.ExitStatusException; import rife.bld.publish.PomBuilder; import rife.tools.FileUtils; @@ -45,6 +42,8 @@ import rife.tools.exceptions.FileUtilsErrorException; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; @@ -240,4 +239,25 @@ public class MobibotBuild extends Project { .extension(".kt") .execute(); } + + @Override + public void test() throws Exception { + var testResultsDir = "build/test-results/test/"; + + var op = testOperation().fromProject(this); + op.testToolOptions().reportsDir(new File(testResultsDir)); + op.execute(); + + 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(); + } + } }