-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Add baseline coverage support to Java compilation action #26341
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
base: master
Are you sure you want to change the base?
Conversation
5a544a7 to
dc0b753
Compare
|
Stacked on #26340, please ignore the first commit. |
# Conflicts: # src/java_tools/buildjar/java/com/google/devtools/build/buildjar/instrumentation/JacocoInstrumentationProcessor.java
e361e1d to
b6b39df
Compare
|
@hvadehra Friendly ping, what needs to be done to get this merged? |
|
@c-mita for coverage |
|
@c-mita Friendly ping, this would need to get into Bazel 9 so that further Starlark work can be based on it |
|
c-mita is OOO for a while, let's get this merged. |
|
@fmeum (this wasn't a problem before this change because Footnotes
|
|
Updating jacoco SGTM, if @meteorcloudy is okay with using an unreleased version. |
|
We check-in prebuilt jars for jacoco: https://github.com/bazelbuild/bazel/tree/master/third_party/java/jacoco Are we going to switch from build from source, I'm okay with that. |
|
@meteorcloudy I can send an update to the prebuilt jars, but I guess you would want a Googler to generate them? Anything I can do to help with that? |
|
Hmm, we used to download those jars from https://mvnrepository.com/artifact/org.jacoco/jacoco-maven-plugin, I'm not really comfortable with checking in custom built jars. How important is this? Could we wait for the official relesae? |
|
We can wait |
|
0.8.14 is out now: https://search.maven.org/remotecontent?filepath=org/jacoco/jacoco/0.8.14/jacoco-0.8.14.zip I've never gone through the update procedure for JaCoCo. Does it help if I send a PR for the first step or would you rather do it yourself to ensure that the jars haven't been tampered with? |
Jacoco changed some things that means Bazel's branch analyzer needs updating. I have already done the updates for our internal version and can easily update Bazel's when I'm back from paternity leave in a couple of weeks. |
|
Speaking to @hvadehra, I would really like to avoid adding the dependency on Whilst I could resolve the issue now (and might do so for other reasons), this is likely to cause a problem in the future due to version skew. I think the "simplest" solution might a separate java binary that just gets run on the output jar that just performs coverage on the uninstrumented class files. I did an experiment with things internally a while back with a binary that consumed a java_binary's |
Could you elaborate on the kind of version skew you are worried about? JaCoCo is already a dependency of |
|
Fundamentally the issue is that we have a version of Jacoco internally that is currently not the same version as the copy Bazel uses. We also cannot maintain two versions internally. Whilst I would like to keep the Bazel's version and Google's version in sync as much as possible, it isn't practical to keep them perfectly in sync. For |
|
I see, thanks for the explanation. What makes the usage through |
Well, it's been forked already.
Obviously whatever does the actual generation of a baseline coverage report is going to have to depend on I would like to avoid forking a complex binary, but a trivial one (if it's even necessary) is less of an issue. |
JacocoInstrumentationProcessoroptionally analyzes all instrumented classes withnullprobes and generates an LCOV baseline report.create_compilation_actiongains abaseline_coverage_fileparameter thatrules_javacan use to supply the desired output file for the baseline report.Work towards #5716