Reputation: 7852
I've a rule with a conditional attribute:
some_rule(
name = "my_rule",
some_attr = select({
":ts_diagnostics_mode_extended": ["--extendedDiagnostics"]
}),
)
and with the config setting:
config_setting(
name = "ts_diagnostics_mode_extended",
values = { "define": "ts_diagnostics_mode=extended_diagnostics" }
)
However, when building with bazel build :my_target --define ts_diagnostics_mode=extended_diagnostics
I get
Configurable attribute "some_attr" doesn't match this configuration (would a default condition help?).
What's missing?
Upvotes: 4
Views: 2563
Reputation: 46
While define_values
indeed works, your original example with values
should also work. define_values
is only necessary when you want the config_setting
to have multiple entries.
See this line in the define_values documentation:
--define
can still appear invalues
with normal flag syntax, and can be mixed freely with this attribute as long as dictionary keys remain distinct.
Upvotes: 1
Reputation: 18985
--define
flags are handled specially by config_setting
, via define_values
, because they are multi-valued. I think this will work:
config_setting(
name = "ts_diagnostics_mode_extended",
define_values = { "ts_diagnostics_mode": "extended_diagnostics" }
)
Upvotes: 3