Allow platform-specific startup bazelrc flags#26882
Conversation
gregestren
left a comment
There was a problem hiding this comment.
Idea LGTM. I'd update the docs to acknowledge startup support too (maybe just acknowledge on the https://bazel.build/run/bazelrc#enable_platform_specific_config).
And this one isn't triggered by the flag?
| && !command.equals(ALWAYS_PSEUDO_COMMAND) | ||
| && !command.equals(COMMON_PSEUDO_COMMAND)) { | ||
| && !command.equals(COMMON_PSEUDO_COMMAND) | ||
| && !command.equals(STARTUP_PSEUDO_COMMAND)) { |
There was a problem hiding this comment.
What makes this necessary now if startup was already a known key?
Naively, couldn't the C++ code remove the arch-specific suffix so at this point Bazel sees the same generic startup setting it would see for any other it already processes?
There was a problem hiding this comment.
validCommands here is the literal subcommands like build, test etc, so it doesn't include startup. Without this addition this logic prints:
WARNING: while reading option defaults file '/private/tmp/foo/.bazelrc':
invalid command name 'startup:linux'.
There was a problem hiding this comment.
Naively, couldn't the C++ code remove the arch-specific suffix so at this point Bazel sees the same generic startup setting it would see for any other it already processes?
I think that would work, but I don't know of any downsides with this change either. I could imagine that version being worse for --announce_rc output but currently that doesn't show any difference AFAICT
There was a problem hiding this comment.
validCommands here is the literal subcommands like build, test etc, so it doesn't include startup
That makes sense. But why wasn't this an issue before with existing startup: --foo settings? I think somehow those are stripped out before they get to this point, but startup:linux isn't?
I think that would work, but I don't know of any downsides with this change either.
If that works, IMO it's a bit nicer in that it's a more isolated change. Just change a single function in the .cc file and no changes needed for this file?
I could imagine that version being worse for --announce_rc output but currently that doesn't show any difference AFAICT
If that's less accurate, that's a fair critique. What specifically might it say inaccurately? You didn't actually notice that happening?
To be clear, I'm not super-familiar with the C++ options parsing. These questions are mostly me trying to clarify my basic understanding of the surrounding code.
There was a problem hiding this comment.
ok my understanding of this has changed reading more.
before this change this logic would warn if you have something like startup:foo in your .bazelrc, since that was always invalid, with this change, that warning never appears (although we could keep it as long as we manually filtered out the known valid platform based ones)
but the C++ logic and this java parsing logic are entirely separate. they both parse the bazelrc separately, so I think we have to have changes in both places. the C++ logic doesn't forward it post-parse, it just applies the settings and drops its knowledge of things AFAICT.
d962ff2 to
35d5d85
Compare
|
docs updated!
correct. my thought was it wasn't worth gating since this couldn't have had previously functioning configs to conflict with (I think I'm also hoping that in the future we can remove |
This enables the use of `startup:linux`, `startup:macos`, etc. This is always enabled. Fixes #22763 RELNOTES[inc]: Add support for `startup:linux`, `startup:macos`, etc bazelrc options.
35d5d85 to
d5945de
Compare
|
@gregestren is this good to be merged? |
|
@gregestren friendly ping |
|
@bazel-io fork 9.1.0 |
This enables the use of `startup:linux`, `startup:macos`, etc. This is always enabled. Fixes bazelbuild#22763 RELNOTES[inc]: Add support for `startup:linux`, `startup:macos`, etc bazelrc options. Closes bazelbuild#26882. PiperOrigin-RevId: 896083689 Change-Id: Id4da6e6689e337951664317755596cfd4ab52703
….com/baz… (#29251) …elbuild/bazel/pull/26882) This enables the use of `startup:linux`, `startup:macos`, etc. This is always enabled. Fixes #22763 RELNOTES[inc]: Add support for `startup:linux`, `startup:macos`, etc bazelrc options. Closes #26882. PiperOrigin-RevId: 896083689 Change-Id: Id4da6e6689e337951664317755596cfd4ab52703 <!-- Thank you for contributing to Bazel! Please read the contribution guidelines: https://bazel.build/contribute.html --> ### Description <!-- Please provide a brief summary of the changes in this PR. --> ### Motivation <!-- Why is this change important? Does it fix a specific bug or add a new feature? If this PR fixes an existing issue, please link it here (e.g. "Fixes #1234"). --> ### Build API Changes <!-- Does this PR affect the Build API? (e.g. Starlark API, providers, command-line flags, native rules) If yes, please answer the following: 1. Has this been discussed in a design doc or issue? (Please link it) 2. Is the change backward compatible? 3. If it's a breaking change, what is the migration plan? --> No ### Checklist - [ ] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes <!-- If this is a new feature, please add 'RELNOTES[NEW]: <description>' here. If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here. If this change should be mentioned in release notes, please add 'RELNOTES: <reason>' here. --> RELNOTES: None Commit ea7b4ba Co-authored-by: Keith Smiley <[email protected]>
….com/baz… (bazelbuild#29251) …elbuild/bazel/pull/26882) This enables the use of `startup:linux`, `startup:macos`, etc. This is always enabled. Fixes bazelbuild#22763 RELNOTES[inc]: Add support for `startup:linux`, `startup:macos`, etc bazelrc options. Closes bazelbuild#26882. PiperOrigin-RevId: 896083689 Change-Id: Id4da6e6689e337951664317755596cfd4ab52703 <!-- Thank you for contributing to Bazel! Please read the contribution guidelines: https://bazel.build/contribute.html --> ### Description <!-- Please provide a brief summary of the changes in this PR. --> ### Motivation <!-- Why is this change important? Does it fix a specific bug or add a new feature? If this PR fixes an existing issue, please link it here (e.g. "Fixes bazelbuild#1234"). --> ### Build API Changes <!-- Does this PR affect the Build API? (e.g. Starlark API, providers, command-line flags, native rules) If yes, please answer the following: 1. Has this been discussed in a design doc or issue? (Please link it) 2. Is the change backward compatible? 3. If it's a breaking change, what is the migration plan? --> No ### Checklist - [ ] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes <!-- If this is a new feature, please add 'RELNOTES[NEW]: <description>' here. If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here. If this change should be mentioned in release notes, please add 'RELNOTES: <reason>' here. --> RELNOTES: None Commit bazelbuild@ea7b4ba Co-authored-by: Keith Smiley <[email protected]>
This enables the use of `startup:linux`, `startup:macos`, etc. This is always enabled. Fixes #22763 RELNOTES[inc]: Add support for `startup:linux`, `startup:macos`, etc bazelrc options. Closes #26882. PiperOrigin-RevId: 896083689 Change-Id: Id4da6e6689e337951664317755596cfd4ab52703 <!-- Thank you for contributing to Bazel! Please read the contribution guidelines: https://bazel.build/contribute.html --> ### Description <!-- Please provide a brief summary of the changes in this PR. --> ### Motivation <!-- Why is this change important? Does it fix a specific bug or add a new feature? If this PR fixes an existing issue, please link it here (e.g. "Fixes #1234"). --> ### Build API Changes <!-- Does this PR affect the Build API? (e.g. Starlark API, providers, command-line flags, native rules) If yes, please answer the following: 1. Has this been discussed in a design doc or issue? (Please link it) 2. Is the change backward compatible? 3. If it's a breaking change, what is the migration plan? --> No ### Checklist - [ ] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes <!-- If this is a new feature, please add 'RELNOTES[NEW]: <description>' here. If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here. If this change should be mentioned in release notes, please add 'RELNOTES: <reason>' here. --> RELNOTES: None Commit ea7b4ba Co-authored-by: Keith Smiley <[email protected]>
This enables the use of
startup:linux,startup:macos, etc. This isalways enabled.
Fixes #22763
RELNOTES[inc]: Add support for
startup:linux,startup:macos, etcbazelrc options.