Added more logging

This commit is contained in:
Erik C. Thauvin 2023-08-12 00:59:54 -07:00
parent 951329595b
commit 31b7967390
3 changed files with 12 additions and 2 deletions

0
README.md Executable file → Normal file
View file

View file

@ -169,7 +169,7 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
// 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=" + Path.of(buildJacocoExecDir.getPath(), "jacoco.exec"));
// "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")
@ -180,6 +180,10 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
throw new IOException(e);
}
if (LOGGER.isLoggable(Level.INFO) && !quiet) {
LOGGER.log(Level.INFO, "Execution Data: {0}", destFile);
}
if (buildJacocoExec.exists()) {
execFiles.add(buildJacocoExec);
}
@ -237,7 +241,7 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
} else {
for (var f : execFiles) {
if (LOGGER.isLoggable(Level.INFO) && !quiet) {
LOGGER.log(Level.INFO, "Loading execution data file: {0}",
LOGGER.log(Level.INFO, "Loading execution data: {0}",
f.getAbsolutePath());
}
loader.load(f);
@ -319,6 +323,11 @@ public class JacocoReportOperation extends AbstractOperation<JacocoReportOperati
loader.getExecutionDataStore().getContents());
visitor.visitBundle(bundle, sourceLocator());
visitor.visitEnd();
if (LOGGER.isLoggable(Level.INFO) && !quiet) {
LOGGER.log(Level.INFO, "XML Report: file://{0}", xml);
LOGGER.log(Level.INFO, "CSV Report: file://{0}", csv);
LOGGER.log(Level.INFO, "HTML Report: file://{0}/index.html", html);
}
}
/**

View file

@ -63,6 +63,7 @@ class JacocoReportOperationTest {
s.contains("<counter type=\"INSTRUCTION\" missed=\"0\" covered=\"3\"/>"))).isTrue();
}
assertThat(Path.of(html.getPath(), "com.example", "Examples.java.html")).exists();
deleteOnExit(tempDir.toFile());
}