Skip to content

Commit

Permalink
Fix Java coverage collection with Java 8 runtime
Browse files Browse the repository at this point in the history
`JacocoCoverageRunner` is run with the target runtime, not the exec runtime, and thus needs to be compatible with a Java 8 runtime.

Fixes #17165

Closes #17338.

PiperOrigin-RevId: 509123073
Change-Id: I41d7255e1f3c3dd3864082899d5dc9ab2cc82027
  • Loading branch information
fmeum authored and copybara-github committed Feb 13, 2023
1 parent 7227fd4 commit c266651
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public IReportVisitor createVisitor(
private Map<String, ISourceFileCoverage> sourceToFileCoverage = new TreeMap<>();

private String getExecPathForEntryName(String classPath) {
if (execPathsOfUninstrumentedFiles.isEmpty()) {
if (!execPathsOfUninstrumentedFiles.isPresent()) {
return classPath;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ The Java target version (e.g., '6' or '7'). It specifies for which Java runtime
<!-- #END_BLAZE_RULE.ATTRIBUTE --> */
.add(
attr("jacocorunner", LABEL)
// This needs to be in the execution configuration.
.cfg(ExecutionTransitionFactory.create())
.allowedFileTypes(FileTypeSet.ANY_FILE)
.exec())
/* <!-- #BLAZE_RULE(java_toolchain).ATTRIBUTE(proguard_allowlister) -->
Expand Down

0 comments on commit c266651

Please sign in to comment.