Description of the problem / feature request:
The query language lacks a way to express "I want to query all targets that are compatible with a certain platform. This is because even though you can use attr() with cquery to ask for values of the attribute, thats not good enough as the attribute is transitive and dependencies might be incompatible, causing the target to still be incompatible even though it has no attribute itself.
We had to work around this by manually running over the proto output of cquery and checking the target_compatible_with attribute of a rule and its dependencies manually in Go code.
The query language should have a function that allows one to query if a rule is compatible, something along the lines of compatible_with(<rule>, <constraint>), with compatible_with(<rule>) defaulting to @local_config_platform//:host as constraint.
Feature requests: what underlying problem are you trying to solve with this feature?
I'm trying to avoid needing to manually run over the analysis proto manually, which is slow, error prone, easy to get wrong and also restricts my ability to meaningfully use other operators alongside
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This is a feature request, any use of target_compatible_with in a dependency and then trying to cquery compatible rules in any way will stumble on this.
What operating system are you running Bazel on?
We use bazel on MacOS and Linux.
What's the output of bazel info release?
release 4.0.0
If bazel info release returns "development version" or "(@Non-Git)", tell us how you built Bazel.
N/A
What's the output of git remote get-url origin ; git rev-parse master ; git rev-parse HEAD ?
N/A
Have you found anything relevant by searching the web?
I've discussed this on the bazel slack and was told I should likely log a feature request
Any other information, logs, or outputs that you want to share?
Description of the problem / feature request:
The query language lacks a way to express "I want to query all targets that are compatible with a certain platform. This is because even though you can use attr() with cquery to ask for values of the attribute, thats not good enough as the attribute is transitive and dependencies might be incompatible, causing the target to still be incompatible even though it has no attribute itself.
We had to work around this by manually running over the proto output of cquery and checking the target_compatible_with attribute of a rule and its dependencies manually in Go code.
The query language should have a function that allows one to query if a rule is compatible, something along the lines of
compatible_with(<rule>, <constraint>), withcompatible_with(<rule>)defaulting to@local_config_platform//:hostas constraint.Feature requests: what underlying problem are you trying to solve with this feature?
I'm trying to avoid needing to manually run over the analysis proto manually, which is slow, error prone, easy to get wrong and also restricts my ability to meaningfully use other operators alongside
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
This is a feature request, any use of
target_compatible_within a dependency and then trying to cquery compatible rules in any way will stumble on this.What operating system are you running Bazel on?
We use bazel on MacOS and Linux.
What's the output of
bazel info release?release 4.0.0If
bazel info releasereturns "development version" or "(@Non-Git)", tell us how you built Bazel.N/A
What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD?N/A
Have you found anything relevant by searching the web?
I've discussed this on the bazel slack and was told I should likely log a feature request
Any other information, logs, or outputs that you want to share?