-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass the name of the classpath manifest jar to JacocoCoverageRunner #21365
Conversation
Do we need to handle version-skew between Bazel and java_tools? If so, we may need to add a bit more logic to JacocoCoverageRunner? |
Yes, I think we need to. java_tools / rules_java upgrades happen more frequently than bazel upgrades. |
703842e
to
260915e
Compare
Done. It's not a tested path since the Bazel shell tests always use a fresh build, but I have verified that it should work. |
Just a quick clarification before I properly review, my understanding is this change is currently doing two things:
Why are we doing (2)? If we think that fixes things, then we don't need (1). My concern is we're subtly altering behavior for currently released Bazel on a java_tools upgrade. Can we not just do (1) and cherry pick that into 7.1? |
Whilst I may suspect that 2. fixes things in all cases, I cannot prove it. Hence 1. Just doing 1. breaks things if java_tools is ahead of Blaze, since we're looking for an environment variable that isn't being set and ignoring the one that is. If that's not a problem then 2. is not needed, which is what I originally asked. |
Sorry, I guess I misunderstood your question about version skew. I meant that in Assuming we can get this into 7.1, I think it's safer to leave the old behavior as is if the variable isn't set. This should be acceptable as after all, this is long standing (buggy) behavior and not a regression as such. WDYT? |
85afc5c
to
5d28338
Compare
I don't really get the rationale for that and it doesn't simplify the logic at all. The diff is simply:
Regardless, I've done it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets not disable the tests. For the new test case that currently only works for java_tools built at HEAD, maybe exit early if JAVA_TOOLS == 'released"
?
Also maybe add a TODO to clean up the legacy logic in java_stub_template.txt
when we update to a new java_tools version that includes this change?
Good point on the test; done. |
@bazel-io fork 7.1.0 |
When the java classpath exceeds the limit, we create a manifest JAR and pass that on the classpath. JacocoCoverageRunner knows how to extract information from this JAR. But if another JAR ends up on that classpath, it confuses the coverage runner which is expecting only a single jar in this case. This changes the java_stub_template file to export the name of the created manifest jar so the coverage runner can extract it. We also change the template file so the relevant exports don't occur in the middle of a larger function. It's possible this is somewhat overengineered and that we could always rely on the manifest jar always being the first one discovered by the coverage runner, but it is not totally obvious to me that that will always be true. Fixes bazelbuild#21268 Closes bazelbuild#21365. PiperOrigin-RevId: 608333782 Change-Id: I9895689fd9d771c9198e36bef222a9f86ada573e
…Runner (#21413) When the java classpath exceeds the limit, we create a manifest JAR and pass that on the classpath. JacocoCoverageRunner knows how to extract information from this JAR. But if another JAR ends up on that classpath, it confuses the coverage runner which is expecting only a single jar in this case. This changes the java_stub_template file to export the name of the created manifest jar so the coverage runner can extract it. We also change the template file so the relevant exports don't occur in the middle of a larger function. It's possible this is somewhat overengineered and that we could always rely on the manifest jar always being the first one discovered by the coverage runner, but it is not totally obvious to me that that will always be true. Fixes #21268 Closes #21365. Commit a2ebdf7 PiperOrigin-RevId: 608333782 Change-Id: I9895689fd9d771c9198e36bef222a9f86ada573e Co-authored-by: Charles Mita <cmita@google.com>
When the java classpath exceeds the limit, we create a manifest JAR
and pass that on the classpath. JacocoCoverageRunner knows how to
extract information from this JAR. But if another JAR ends up on that
classpath, it confuses the coverage runner which is expecting only a
single jar in this case.
This changes the java_stub_template file to export the name of the
created manifest jar so the coverage runner can extract it.
We also change the template file so the relevant exports don't occur
in the middle of a larger function.
It's possible this is somewhat overengineered and that we could
always rely on the manifest jar always being the first one discovered
by the coverage runner, but it is not totally obvious to me that that
will always be true.
Fixes #21268