-
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
Not possible to override string flag in the config section of bazelrc file from command line #13231
Comments
Here is a complete repro example: example.tar.gz |
@meteorcloudy You added this flag. Can you comment on it? It's not really Configurability's wheelhouse. |
This looks like a bug, I'll take a look |
This feature has some problems as implemented. Most of the time people use config:xx to specify the target platform configuration. The examples that people pointed out in #5055 are mostly about the need to auto-specify different options based on the host platform. The fact that it just selects on 'linux' makes it too easy to fall into the trap of putting both host specific and target specific configuration under the same heading 'linux'. Proposal:
|
The documentation says it clearly it will pick based on the host configurations, anyone who uses this flag should be aware of that. I agree we should have picked a better name, but changing it now will just break our uesrs.
I don't quite understand why should we turn it on by default or just remove it. |
I looked a bit in to this, it doesn't seem to be caused by the I tested some other flags ( |
@AndersSundman Are you sure this works? |
enable_platform_specific_config
I can confirm that it seems to be related to the string flags. I tested the config experiment again and it doesn't seem to work. I must have confused something before.
|
I experienced exactly the same bug in 4.2.1 release. |
Previously, Starlark flags expanded from a --config stanze would always be added to the end of the residue containing the explicitly given Starlark flags. As a result, Starlark flags expanded from --config could not be overridden. With this commit, Starlark flags are parsed with the same semantics as a regular allowMultiple option, thus preserving their order through expansions. This is implemented by introducing a synthetic allowMultiple option of type List<String> in OptionsParserImpl that skipped args are parsed into. As a result, Starlark options are now available from the new getSkippedArgs() method on OptionsParser rather than as part of the residue, with the latter now only containing build targets. Fixes bazelbuild#13231 Fixes bazelbuild#15679 Closes bazelbuild#15807. PiperOrigin-RevId: 467931815 Change-Id: Ic64c6e075c08d898e5e7b8bf4c777827134d89fa
Previously, Starlark flags expanded from a --config stanze would always be added to the end of the residue containing the explicitly given Starlark flags. As a result, Starlark flags expanded from --config could not be overridden. With this commit, Starlark flags are parsed with the same semantics as a regular allowMultiple option, thus preserving their order through expansions. This is implemented by introducing a synthetic allowMultiple option of type List<String> in OptionsParserImpl that skipped args are parsed into. As a result, Starlark options are now available from the new getSkippedArgs() method on OptionsParser rather than as part of the residue, with the latter now only containing build targets. Fixes bazelbuild#13231 Fixes bazelbuild#15679 Closes bazelbuild#15807. PiperOrigin-RevId: 467931815 Change-Id: Ic64c6e075c08d898e5e7b8bf4c777827134d89fa
Description of the problem / feature request:
Flags added to the
build:linux
config (from--enable_platform_specific_config=true
), can't be overridden from the command line.The command line flag value should take precedence, as it does when the flag is added to any other config, but right now the command line option is ignored.
See repro below for a more detailed description of the issue.
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
We would like to set a skylib
string_flag
(a build_config rule) to a default value for Linux but with the option to override that value from the command line.Here is a small BUILD file that introduces the
color
flag and uses it to select a define or another in acc_binary
rule.Here is a
.bazelrc
fileThe intention is for
color
to beundefined
for all platforms except linux. For linux it gets set tored
in the.bazelrc
file.The bug is that it's not possible to override this
color
value from the command linebazel build //:test --//:color=black
Even when doing this ^ (on linux), the value of
color
isred
.Without the
build:linux
in the.bazelrc
, overriding works as expected:This
bazel build //:test --//:color=red --//:color=black
makescolor
black.Even adding another
build:red --//:color=red
config to the.bazelrc
works as expected. I.e.bazel build //:test --config=red --//:color=black
makescolor
black.The
build:linux
config must be special in some (faulty) way.What operating system are you running Bazel on?
Linux (but I expect that this is the same with auto detected windows config, etc)
What's the output of
bazel info release
?release 4.0.0
Have you found anything relevant by searching the web?
We have looked, but haven't been able to find any other reports of this bug.
The text was updated successfully, but these errors were encountered: