-
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
Add --low_priority_bazelrc #16997
base: master
Are you sure you want to change the base?
Add --low_priority_bazelrc #16997
Conversation
This startup flag behaves exactly as --bazelrc does, but is applied before the workspace bazelrc rather than after. This is useful for people who write and distribute bazel wrappers (which appears to be most large companies). This allows a bazel wrapper to supply new _default_ values to flags, which a repo may choose to override. Without this change, it's impossible for a bazel wrapper to decide to do something like set `--incompatible_enable_cc_toolchain_resolution` because they have no practical way of doing so. if they set this on the command line or in a .bazelrc file passed to the `--bazelrc` flag, it cannot be overridden other than on the command line. This flag allows a wrapper to point at a bazelrc file with extra defaults, which can be overridden in the repo bazelrc file.
/cc @sdtwigg - we discussed this at BazelCon |
What is the behavior of multiple
|
All So we'd effective process:
with later entries in the list taking precedence over earlier ones. |
Have you considered invocation policy instead? https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/invocation_policy.proto |
A great question! I had not, but I've experimented with it now, and think there are some pros and cons; here are some thoughts: Pros:
Cons:
There are also a few missing features and rough edges around
|
In theory per-tool/org config policies is what invocation-policy is for, though I concede this isn't terribly well documented. If there are gaps then I think it's worth figuring out if we can close them before adding another rc knob. Do you think you could see if an invocation-policy approach could be made tenable? |
I definitely agree with closing the gaps - I've just sent out #17035 for the
I think it could be made tenable for the particular use-case I'm looking at right now, but I do worry long-term about the hierarchy issues - I can easily imagine a world where three organisations want to progressively apply their own invocation policies (e.g. as described, aspect-CLI, an infra team, and a product team). Considering how we can merge multiple |
I can do more than imagine this, as rules_xcodeproj and BuildBuddy Workflows already do this, and eventually we will add the BuildBuddy CLI into the mix. |
It feels like the really fiddly piece of merging invocation policies is around when values are banned. In all other cases, concatenating the policies is a reasonable thing to do (and it's on tools to make sure they pass the flags in the correct order). Maybe we could resolve this by making it allowed to have multiple |
I agree the crux will be figuring out how to merge the policies. Without thinking too deep into it, one possibility is allowing individual policies to set their own merge policy, but this could use more thought/discussion (maybe lifted to an issue?). Note that it's entirely possible that I should also mention, there's some uncertainty about the layering of rc files, divergence in how rc files are handed in bazel/blaze that would need to be reconciled, and tools that introspect rc files that would need to be updated. I'm hoping that by exploring invocation policy we could sidestep dealing with these things :). |
Sounds good - @brentleyjones can I interest you in maybe taking the lead on that, as someone with a concrete use-case today?
Makes sense!
I've also filed #17042 to address this one, choosing to warn (rather than be silent or error). |
I'm willing to test out changes or provide feedback, but I have a lot on my plate currently and can't really take anything else on for a while. We also have work arounds that work for now, so this isn't a blocker for us. |
This startup flag behaves exactly as --bazelrc does, but is applied before the workspace bazelrc rather than after.
This is useful for people who write and distribute bazel wrappers (which appears to be most large companies). This allows a bazel wrapper to supply new default values to flags, which a repo may choose to override.
Without this change, it's impossible for a bazel wrapper to decide to do something like set
--incompatible_enable_cc_toolchain_resolution
because they have no practical way of doing so. if they set this on the command line or in a .bazelrc file passed to the--bazelrc
flag, it cannot be overridden other than on the command line. This flag allows a wrapper to point at a bazelrc file with extra defaults, which can be overridden in the repo bazelrc file.