-
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
Emit labels in display form in Java rules #21180
Conversation
Stacked on #21179, please ignore the first commit during review. |
The Starlark actions can use `Label.to_display_form()`. Java compilation actions, which are still implemented in Java, can't access the main repository mapping via `BazelModuleContext` and instead retrieve it from a new field on `AnalysisEnvironment`.
@hvadehra This PR is no longer stacked. |
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.
LGTM for java changes.
@meteorcloudy for tests now requiring network.
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.
Yep, currently there is no way around it. Adding requires-network
looks fine.
@bazel-io fork 7.1.0 |
Buildozer fixes for Java strict deps violations referring to external repositories now contain labels in display form, which avoid canonical repository names that should never be added to BUILD files and aren't understood by `buildozer`. The Starlark actions can use `Label.to_display_form()`. Java compilation actions, which are still implemented in Java, can't access the main repository mapping via `BazelModuleContext` and instead retrieve it from a new field on `AnalysisEnvironment`. Closes bazelbuild#21180. PiperOrigin-RevId: 607803030 Change-Id: I0cdccabfde0217c9201cef9ca9d260b0c8ca27cd
Buildozer fixes for Java strict deps violations referring to external repositories now contain labels in display form, which avoid canonical repository names that should never be added to BUILD files and aren't understood by `buildozer`. The Starlark actions can use `Label.to_display_form()`. Java compilation actions, which are still implemented in Java, can't access the main repository mapping via `BazelModuleContext` and instead retrieve it from a new field on `AnalysisEnvironment`. Closes #21180. Commit b11fa7a PiperOrigin-RevId: 607803030 Change-Id: I0cdccabfde0217c9201cef9ca9d260b0c8ca27cd --------- Co-authored-by: Fabian Meumertzheim <[email protected]> Co-authored-by: hvadehra <[email protected]>
Unfortunately, this change was rolled back at fd048d3 due to a memory regression. |
@hvadehra Do you know whether the Starlark part would have been fine by itself? If so, I could try to pass this argument into the native action from Starlark instead. |
@fmeum As noted in fd048d3, the issue is we're adding a new skyframe edge for every target/aspect. The exact cost of such a edge is a little hard to calculate in general due to skyframe optimizations. It can be particularly expensive for certain transitions in the number of edges (cc @justinhorvitz to keep me honest about this). Additionally, we'd like to avoid the edge completely internally (i.e. no external repositories). Even for Bazel, it would be nice to only add the edge when required. Not sure if there's a good way to do that though. Solving the latter should also solve the former though. |
I tried out an experimental fix yesterday which dropped the edge in the target/aspect functions when external repos were not in play, and there was still some regression. So I suspect not. But I can try and measure more exactly. |
@hvadehra Thanks for the explanation. I will try to hide this edge in |
I have already been a bit worried about the memory impact of an additional I will submit separate PRs for Starlark and native actions. |
Buildozer fixes for Java strict deps violations referring to external repositories now contain labels in display form, which avoid canonical repository names that should never be added to BUILD files and aren't understood by
buildozer
.The Starlark actions can use
Label.to_display_form()
. Java compilation actions, which are still implemented in Java, can't access the main repository mapping viaBazelModuleContext
and instead retrieve it from a new field onAnalysisEnvironment
.