-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Description of the problem / feature request / question:
Currently, if a bazelrc file contains a common
line, then all of the specified options are passed to every bazel command that is run. I propose that the common
line always allow all legal options that can apply to any command, but silently ignore the ones that don't apply to the current command.
The current behavior can easily lead to unnecessary error messages, and greatly hampers the usefulness of the common
feature.
For one thing, there are very few Bazel options that are actually common across every command.
Also, although bazelrc supports inheritance (e.g. test
and run
will automatically inherit from any build
lines), that inheritance isn't always enough. For example, suppose I want to have a custom --package_path
for every Bazel command that supports that flag. It's not sufficient to write
build --package_path ...
because that will apply to build
, test
, and run
, but not to fetch
, info
, and query
, which do not inherit from build
but do support the --package_path
option.
I could write
build --package_path ...
fetch --package_path ...
info --package_path ...
query --package_path ...
But that is (a) messy, (b) requires me to do a lot of research to carefully figure out which commands support --package_path
, and (c) could break in the future if I upgrade to a newer version of Bazel that supports --package_path
for additional commands.
What I really want is to write
common --package_path ...
but I can't, because that breaks any command that doesn't support that flag, such as bazel help
.
I think probably the best way to address this is what I proposed above: The common
line always allows all legal options that can apply to any command, but silently ignores the ones that don't apply to the current command.
So common --package_path ...
would never cause an error, but common --invalid_flag
would cause an error.
Environment info
- Operating System:
OS X
- Bazel version (output of
bazel info release
):
0.4.5