Support multiple --bazelrc on command line#12740
Support multiple --bazelrc on command line#12740wisechengyi wants to merge 42 commits intobazelbuild:masterfrom
Conversation
bierbaum
left a comment
There was a problem hiding this comment.
Hi Yi, I left some style nits to get this change in line with what is going on in this codebase.
You also might want to add coverage in src/test/cpp/startup_options_test.cc.
In terms of |
|
cc: @juliexxia |
|
Hi @michajlo I have made the changes as discussed. Please kindly give it another go when you get a chance. Thanks! |
|
Comment addressed. Thanks! |
318d34c to
34786aa
Compare
|
I had overlooked that there's some documentation that needs to be updated. Can you update https://github.com/bazelbuild/bazel/blob/master/site/docs/guide.md and https://github.com/bazelbuild/bazel/blob/master/site/docs/user-manual.html, and do a quick skim to see if there's anything else we missed? |
|
I think this instance is fine to change. |
wisechengyi
left a comment
There was a problem hiding this comment.
Doc updated. https://github.com/bazelbuild/bazel/blob/master/site/docs/user-manual.html should be still accurate on --bazelrc
|
Thank you @michajlo ! |
Address #7489 ### Motivation Multiple --bazelrc on CLI would be useful for us for various reasons: Mostly importantly, we will have very long argument lists to pass to bazel query, so they have to be in a bazelrc file. `import/try import` in bazelrc would still work but very awkwardly. For example, if there are multiple bazelrc files to import, say `A` and `B`, import `A` needs to be added into `$WORKSPACE/.bazelrc` import `B` needs to be added into `A` meaning the former bazelrc file needs to know what comes next. Therefore allowing multiple --bazelrc would greatly improve the ergonomics, so the caller can create and append the new bazelrc without modifying the previous rc files. ### Note Options passed on CLI will still overwrite any options specified in any bazelrcs. ### Result `bazel --bazelrc=x.rc --bazelrc=y.rc ...` now works. ``` --bazelrc (a string; default: see description) The location of the user .bazelrc file containing default values of Bazel options. This option can also be chained together. E.g. `--bazelrc=x.rc --bazelrc=y.rc` so options in both RCs will be read. Note: `--bazelrc x.rc y.rc` is illegal, and each bazelrc file needs to be accompanied by --bazelrc flag before it. If unspecified, Bazel uses the first .bazelrc file it finds in the following two locations: the workspace directory, then the user's home directory. Use /dev/null to disable the search for a user rc file, e.g. in release builds. ``` Closes #12740. PiperOrigin-RevId: 364407234
Address #7489
Motivation
Multiple --bazelrc on CLI would be useful for us for various reasons:
Mostly importantly, we will have very long argument lists to pass to bazel query, so they have to be in a bazelrc file.
import/try importin bazelrc would still work but very awkwardly. For example, if there are multiple bazelrc files to import, sayAandB,import
Aneeds to be added into$WORKSPACE/.bazelrcimport
Bneeds to be added intoAmeaning the former bazelrc file needs to know what comes next.
Therefore allowing multiple --bazelrc would greatly improve the ergonomics, so the caller can create and append the new bazelrc without modifying the previous rc files.
Note
Options passed on CLI will still overwrite any options specified in any bazelrcs.
Result
bazel --bazelrc=x.rc --bazelrc=y.rc ...now works.