Skip to content

Commit

Permalink
Cleaned up java agent loading to fully support other (TestNG) extensi…
Browse files Browse the repository at this point in the history
…ons. Closes #2
  • Loading branch information
ethauvin committed Apr 4, 2024
1 parent 2cd4074 commit a89eb59
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/lib/bld/bld-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions examples/src/bld/java/com/example/ExamplesBuild.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public ExamplesBuild() {
name = "Examples";
version = version(0, 1, 0);

javaRelease = 17;

downloadSources = true;
autoDownloadPurge = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/rife/bld/extension/JacocoReportOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,12 @@ public void execute() throws IOException {
}

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);
}
Expand Down

0 comments on commit a89eb59

Please sign in to comment.