Open honnix opened 4 months ago
After a closer look, I believe this is not caused by version mismatching, but as long as there is another jacoco jar in classpath before JacocoCoverage_jarjar_deploy.jar
, because shading changed import path so org/jacoco/core/internal/flow/ClassProbesAdapter
in the original jacoco jar cannot be assigned to com/google/testing/coverage/jarjar/org/objectweb/asm/ClassVisitor
.
Description of the bug:
Bazel version 7.1.1
JacocoCoverage_jarjar_deploy.jar
used bybazel coverge
does not shade everything and it may cause class incompatibility. For example, in one of our tests, we have jacoco jars (0.8.11) in runtime classpath (we have those for reasons) and at runtime it conflicts with one of the shaded classcom/google/testing/coverage/jarjar/org/objectweb/asm/ClassVisitor
, which results in no coverage data being generated. The error is as following:Besides jacoco jars, there are also other unshaded classes that might cause similar issue, for example errorprone, javax annoation, etc.
Is it reasonable to shade all 3rd party deps to avoid similar issues?
Which category does this issue belong to?
External Dependency, Java Rules
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Pulling in jacoco 0.8.11 into runtime classpath and run
bazel coverage --combined_report=lcov <target>
. The following outputs are expected:_coverage_report.dat
has 0 size.The test log contains the exception mentioned above.
Which operating system are you running Bazel on?
macOS 14.4
What is the output of
bazel info release
?release 7.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No
Have you found anything relevant by searching the web?
We are aware of https://github.com/bazelbuild/bazel/pull/20996 but it's not in 7.1.1.
Any other information, logs, or outputs that you want to share?
No response