Allow filtering of expanded targets according to the available exec configuration (like target_compatible_with
but for exec
)
#16206
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
team-Configurability
platforms, toolchains, cquery, select(), config transitions
type: feature request
Description of the feature request:
The
target_compatible_with
attribute allows skipping targets (and targets that transitively depend on it) when using target pattern expansion (e.g.//...
), which is great.Now, it appears that
exec_compatible_with
does not work that way: it adds constraints, but still includes the target (and targets that transitively depend on it) during target pattern expansion. In other words, if we don't have any way to satisfy theseexec
constraints, the build will fail (No matching toolchains
) instead of skipping the target.The suggested feature is to achieve the equivalent of
target_compatible_with
but for theexec
config.What underlying problem are you trying to solve with this feature?
As a user, I want
bazel build //...
to be successful both locally on macos and on Linux for my repository, even if that means skipping some targets that I would otherwise not be able to build on a given platform. Note that this is a goal stated in https://bazel.build/community/roadmaps-configurability#goal.One of the targets in my repository builds a docker image and depends on a binary in a "Linux OS" configuration; unfortunately we do not support cross-compiling this binary from macos to Linux. So I would like this target to be skipped when running it on a Mac.
In summary, I would like to be able to say "when running
bazel build //...
, don't build this target (nor its dependents) if you can't findexec
utors that satisfy theLinux OS
constraint".(another problem that might be worth solving is the fact that
target_compatible_with
andexec_compatible_with
are not doing equivalent things withtarget
andexec
configurations despite having having equivalent option names)Which operating system are you running Bazel on?
Mac, Linux
What is the output of
bazel info release
?release 5.1.1
Have you found anything relevant by searching the web?
Related to #10945 (
target_compatible_with
implementation).The text was updated successfully, but these errors were encountered: