question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The query language lacks a way to query rules that are target_compatible_with

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gregestrencommented, Jan 29, 2021

Happy to review promptly.

1reaction
philsccommented, Jan 29, 2021

Cool. I’ll get that turned into a pull request then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The Bazel Query Reference
This page is the reference manual for the Bazel Query Language used ... is a target pattern that evaluates to a set containing...
Read more >
Using feature queries - CSS: Cascading Style Sheets | MDN
In this guide you will learn how to implement progressive enhancement using feature queries. Syntax. CSS feature queries are part of the CSS ......
Read more >
ALTER DATABASE (Transact-SQL) compatibility level
Sets Transact-SQL and query processing behaviors to be compatible with the specified version of the Database Engine.
Read more >
Annotation Query Language reference - IBM Cloud Docs
Refer to JSON document formats for details on how to create a document that conforms to a schema. module person; -- Require document...
Read more >
Writing Queries and Interpreted Expressions - Eclipse
Some general rules are independent of the language details. ... Starting from Sirius 3.1, AQL (Acceleo Query Language, first introduced in Sirius 3.0)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found