Implement configuration settings that pertain to a single binary #16708
Labels
P2
We'll consider working on this in future. (Assignee optional)
team-Configurability
Issues for Configurability team
type: feature request
Description of the feature request:
It would be nice if one could implement configuration fragments that pertain to a part of the configured target graph.
The use case is that some projects want to compile a binary in different configurations, but not necessarily its dependencies. For example, one might want to compile a C++ binary with some sort of sanitizer. The natural place for the "which sanitizer to use" knob is the configuration, but that propagates to the whole transitive closure of the binary, even to places which are obviously unaffected by it (for example, a genrule that generates a source file) or to places where the decision as to which sanitizer to use is different (for example, another binary in the
data=
attribute.So it looks like there is some room for the concept of "configuration variable that applies to whatever is built into a binary":.
There are ways one could work around this: for example, one could write their own custom C++ rule that has "remove sanitizer" transition for every dependency that's not through
deps=
, but that's only a partial answer, because one could imagine cases where this flag needs to be removed fromdeps=
, too (for example, if it's a genrule that generates an object file)Implementing this purely in Starlark isn't possible because it requires knowing the rule class on both ends of the dependency edge and neither outgoing nor incoming transitions can do that.
What underlying problem are you trying to solve with this feature?
No response
Which operating system are you running Bazel on?
No response
What is the output of
bazel info release
?No response
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 master; 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
The text was updated successfully, but these errors were encountered: