Cleaned up java agent loading to fully support other (TestNG) extensions. Closes #2

This commit is contained in:
Erik C. Thauvin 2024-04-03 20:15:15 -07:00
parent 2cd4074880
commit a89eb59043
Signed by: erik
GPG key ID: 776702A6A2DA330E
4 changed files with 10 additions and 11 deletions

View file

@ -1,6 +1,6 @@
bld.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true
bld.extension-jacoco=com.uwyn.rife2:bld-jacoco-report:0.9.4
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.version=1.9.0

View file

@ -17,6 +17,8 @@ public class ExamplesBuild extends Project {
name = "Examples";
version = version(0, 1, 0);
javaRelease = 17;
downloadSources = true;
autoDownloadPurge = true;

View file

@ -34,9 +34,10 @@ public class JacocoReportOperationBuild extends Project {
public JacocoReportOperationBuild() {
pkg = "rife.bld.extension";
name = "JacocoReportOperation";
version = version(0, 9, 4);
version = version(0, 9, 5);
javaRelease = 17;
downloadSources = true;
autoDownloadPurge = true;
repositories = List.of(MAVEN_CENTRAL, RIFE2_RELEASES);

View file

@ -203,16 +203,12 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
}
if (execFiles.isEmpty()) {
// project.testOperation().fromProject(project).javaOptions().javaAgent(
// Path.of(project.libBldDirectory().getPath(), "org.jacoco.agent-"
// + JaCoCo.VERSION.substring(0, JaCoCo.VERSION.lastIndexOf('.')) + "-runtime.jar").toFile(),
// "destfile=" + destFile.getPath());
project.testOperation().fromProject(project).javaOptions().add("-javaagent:" +
Path.of(project.libBldDirectory().getPath(), "org.jacoco.agent-"
+ JaCoCo.VERSION.substring(0, JaCoCo.VERSION.lastIndexOf('.')) + "-runtime.jar")
+ "=destfile=" + destFile.getPath());
var testOperation = project.testOperation().fromProject(project);
testOperation.javaOptions().javaAgent(Path.of(project.libBldDirectory().getPath(),
"org.jacoco.agent-" + JaCoCo.VERSION.substring(0, JaCoCo.VERSION.lastIndexOf('.'))
+ "-runtime.jar").toFile(), "destfile=" + destFile.getPath());
try {
project.testOperation().execute();
testOperation.execute();
} catch (InterruptedException | ExitStatusException e) {
throw new IOException(e);
}