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.

`bazel query` call to output groups or providers of a target

See original GitHub issue

Description of the problem / feature request:

It would be handy to be able to use bazel query to list all of the output groups or providers that a target returns. This makes it easier for new users of bazel and for folks developing new rules or aspects to learn what you can rely on from a target and ease the API discovery process.

Feature requests: what underlying problem are you trying to solve with this feature?

There’s a lot of opacity on what a target will actually do and, even with pretty good documentation, you can end up reading a lot of code to figure out what it can give you. A bazel query call you can make to get the output groups or providers would shortcut this process.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
arxanascommented, Apr 10, 2021

Here is a full example of the new invocation:

bazel cquery '//foo:bar' --output starlark --starlark:expr='providers(target)'

For example, to show just the names of the providers which are available, you can call .keys() on the resulting dict:

bazel cquery '//foo:bar' --output starlark --starlark:expr='providers(target).keys()'
3reactions
c-parsonscommented, Dec 8, 2020

Indeed, it does.

See the new documentation for this feature.

Particularly,

list all of the output groups or providers that a target returns

Use the new providers() function of this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Configurable Query (cquery) - Bazel
This option prints a list of the output files produced by each target matched by the query similar to the list printed at...
Read more >
How to list the output groups of a bazel rule? - Stack Overflow
If you want to get only .so outputs, you can use filegroup with dynamic_library output group. Where can I find the list of...
Read more >
The Bazel Code Base
In Bazel parlance, we call them artifacts (discussed elsewhere). Not all files created during the build are targets; it's common for an output...
Read more >
Is there a way to skip platform incompatible targets during the ...
The problem we hit is that “bazel build ProductA” does not combine with “target_compatible_with” attribute. As soon as in the transitive closure of...
Read more >
buck query
The query language enables you to combine multiple operators in a single command. For example, to retrieve a list of all the tests...
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