Reputation: 1041
Is there a way to instruct bazel to list all the targets it has found without building or testing them?
Upvotes: 4
Views: 3004
Reputation: 790
If you want to list targets taking into account select
statements resolving, take a look at bazel cquery
command.
query
would list targets for all select options, cquery
- only chosen ones
Documentation with great examples
Upvotes: 0
Reputation: 1329
bazel query
can be used to discover targets within a bazel workspace (without building / testing them)
For example;
To find all labels in a given package:
bazel query //some/package:*
If only interested in rules, then:
bazel query 'kind(.*rule, //some/package:*)'
//some/package:*
could be substituted for any valid label expression, eg including all descending packages, //some/package/...
The bazel query docs show further functions that could be used.
Upvotes: 8