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.downloadExtensionJavadoc=false
bld.downloadExtensionSources=true 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.repositories=MAVEN_LOCAL,MAVEN_CENTRAL,RIFE2_SNAPSHOTS,RIFE2_RELEASES
bld.downloadLocation= bld.downloadLocation=
bld.version=1.9.0 bld.version=1.9.0

View file

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

View file

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

View file

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