-
Notifications
You must be signed in to change notification settings - Fork 242
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
Don't export via deps, only via exports #563
Conversation
bazelbuild#557 replaced using `JavaInfo.transitive_exports` by instead using `HasMavenDeps.transitive_exports` but it changed how this was computed. The JavaInfo traversal code: https://github.com/bazelbuild/bazel/blob/5a647bb234ba9817f51fdb2b4b5973a0602f51a4/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java#L341-L357 only follows the `exports` attribute, and merges together each of the transitive exports it finds that way. The replacement starlark code was traversing each of `deps`, `exports`, and `runtime_deps`, looking for anything which may have been exported _to_ those targets, which exports significantly more targets. This adds a unit test to prevent future regressions.
/cc @comius in case the change in behaviour was intended |
No, it was unintentional; I assume you have a case that is broken/different now. Thanks for the fix and the test! Didn't the old code here https://github.com/bazelbuild/rules_jvm_external/pull/557/files#diff-4c35294998684c53cec071ff25a96119a3545b55579a7a21233c83870ed37c6cL56-L58 also collect transitive_exports from deps and runtime_deps? Because artifact_infos are gathered over _ASPECT_ATTRS? |
Do collect transitive exports, but only via a direct exports attribute somewhere in the tree.
Sorry for the delay - I've been out on PTO :)
I do indeed!
I have spent quite a while staring at this code, and I think I now understand the key difference. Your change had the effect of removing this "only via the exports of X" filtering for I've just pushed a commit which I think makes this more clear - when traversing the tree to gather, we only accumulate the Note that this is still a slightly change in behaviour, but based on non-public examples I think it's closer to the original behaviour. |
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.
Sorry it took so long to review. Thank you @illicitonion!
#557 replaced using
JavaInfo.transitive_exports
by instead usingHasMavenDeps.transitive_exports
but it changed how this was computed.The JavaInfo traversal code:
https://github.com/bazelbuild/bazel/blob/5a647bb234ba9817f51fdb2b4b5973a0602f51a4/src/main/java/com/google/devtools/build/lib/rules/java/JavaCommon.java#L341-L357
only follows the
exports
attribute, and merges together each of thetransitive exports it finds that way.
The replacement starlark code was traversing each of
deps
,exports
,and
runtime_deps
, looking for anything which may have been exportedto those targets, which exports significantly more targets.
This adds a unit test to prevent future regressions.