Add jacocorunner to java_toolchain.
The jacoco runner was previously retrieved via an implicit attribute `$jacocorunner` on the `java_binary` and `java_test` rules. Retrieving the runner via the implicit attribute makes testing the tools in the `java_tools` release difficult and inconsistent (almost all other tools are defined via `java_toolchain`).
This PR makes `jacocorunner` part of `java_toolchain`. If `jacocorunner` is not found in the toolchain it falls back to the `$jacocorunner` attribute. The fallback behavior can be removed after a bazel release with this change.
Closes #8378.
PiperOrigin-RevId: 249241175
diff --git a/tools/jdk/BUILD.java_tools b/tools/jdk/BUILD.java_tools
index 5b50221..8617749 100644
--- a/tools/jdk/BUILD.java_tools
+++ b/tools/jdk/BUILD.java_tools
@@ -59,6 +59,8 @@
":java_compiler_jar",
":jdk_compiler_jar",
],
+ # TODO(iirina): Re-enable this after #8378 is merged.
+ # jacocorunner = ":jacoco_coverage_runner"
)
filegroup(
@@ -71,6 +73,11 @@
srcs = ["java_tools/GenClass_deploy.jar"],
)
+java_import(
+ name = "jacoco_coverage_runner",
+ jars = ["java_tools/JacocoCoverage_jarjar_deploy.jar"],
+)
+
filegroup(
name = "JacocoCoverage",
srcs = ["java_tools/JacocoCoverage_jarjar_deploy.jar"],