Open matts1 opened 6 months ago
Triaging to Configurability team, although I do find this suggestion interesting.
Wouldn't https://github.com/bazelbuild/bazel/issues/19975 and https://docs.google.com/document/d/1p02Y9joQSgdXtiTA2mJ_UXHBiBDPPTqrO-oJcupLAu8/edit#heading=h.icwoewbtra8 address this?
i.e. make the existing ConfigMatchingProvider
Starlark-accessible, which is already something we want to do.
Ah, I wrote #19975 to address a slightly different problem, but it does appear that the solution to that also happens to solve this problem.
i.e. make the existing
ConfigMatchingProvider
Starlark-accessible, which is already something we want to do.
Without knowing implementation details, I'm not 100% sure, but it does sound like this would be sufficient.
Description of the feature request:
I'd like
config_setting
andconstraint_value
rules to output a provider corresponding to whether they evaluate to true or false. This would allow us to read them directly in rules.As a follow-on from this, we could potentially have
select
read from the provider itself, thus allowing us to make any ruleselect
'able. This would be extremely useful for a few particular rules:bool_flag
could be chainedselects.config_settings_group
is currently implemented in a very hacky manner. This would allow us to clean that upIt would also allow us to implement arbitrarily complex resolution of config settings. For example, you could have a string_flag, and have a bool setting that checks if it starts with
"linux-"
.This would allow us to write:
Which category does this issue belong to?
Core
What underlying problem are you trying to solve with this feature?
At the moment, if I write:
Then in the rule implementation, I have no way of determining whether the config setting resolves to true or to false, and the same goes for the constraint value.
Which operating system are you running Bazel on?
linux
What is the output of
bazel info release
?7.1.1
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response