-
-
Notifications
You must be signed in to change notification settings - Fork 665
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
Reset Go settings for protoc dependencies #3005
Conversation
No worries, let me know if you need any additional explanations. |
cd757ef
to
6f570a7
Compare
I rebased the PR onto master after my other changes were merged. |
@blico Friendly ping as the required commit has landed in Bazel: bazelbuild/bazel@52d1d4a |
@robfig I just submitted #3108, which is based on this PR and finished the leftover work. Along the way, it fixes a rules_go correctness bug reported in bazelbuild/bazel#14626. Do you think one of the maintainers will have time to review either of those PRs in the near future? |
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.
Passed the tests in Uber's Go monorepo. Left a few stylish comments. Looks good overall. Sorry for taking so long to review.
go/private/rules/transition.bzl
Outdated
|
||
go_reset_target depends on a single target, built using go_reset_transition. | ||
go_exec_reset_target depends on a single target, built using go_exec_reset_transition. |
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.
This doc seems wrong
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.
I took the chance to improve the docs, but am not sure I understood this particular point.
This transition should be applied to all non-Go tools (e.g. protoc) to prevent unnecessary rebuilds.
The test verifies that Go Starlark settings such as bootstrap_nogo and pure are reset before they reach protoc, which is a dependency of go_proto_library in multiple ways.
@linzhp Thanks for the review. I pushed a commit that should address your comments. |
What type of PR is this?
Bug fix
What does this PR do? Why is it needed?
Reduces the number of essentially distinct configurations in which
protoc
as a dependency ofgo_proto_library
is analyzed.Note that this may not (yet) result in a significant reduction of rebuilds since Bazel is not particular friendly to reset transitions at the moment: It encodes some information about the path of transitions taken into the build configuration, which e.g. prevents transitions from ever returning to the top-level target configuration. But this will be solved by bazelbuild/bazel#14023, which is very actively being worked on. In the meantime, this change should at least not regress the current behavior further.
Which issues(s) does this PR fix?
Fixes a part of #2999.
Other notes for review
@robfig If you think that this PR is useful, I would also look into a follow-up that resets the non-Go attrs, e.g.
data
andembedsrcs
, of rules such asgo_library
to their values beforego_transition
. Ideally,rules_go
settings set by transitions would only ever propagate to rules that provide a Go provider. Since this requires memoizing the state of settings before a transition, this will be a bit more complicated, which is why I would like to get your feedback on this simpler case first.