-
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
Support multiple --bazelrc on command line #12740
Conversation
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.
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! |
src/main/java/com/google/devtools/build/lib/bazel/BazelStartupOptionsModule.java
Outdated
Show resolved
Hide resolved
Comment addressed. Thanks! |
src/main/java/com/google/devtools/build/lib/bazel/BazelStartupOptionsModule.java
Outdated
Show resolved
Hide resolved
318d34c
to
34786aa
Compare
src/main/java/com/google/devtools/build/lib/bazel/BazelStartupOptionsModule.java
Outdated
Show resolved
Hide resolved
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. |
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.
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 import
in bazelrc would still work but very awkwardly. For example, if there are multiple bazelrc files to import, sayA
andB
,import
A
needs to be added into$WORKSPACE/.bazelrc
import
B
needs to be added intoA
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.