rohitsan
rohitsan

Reputation: 1041

No way to tell bazel to list all targets without building or testing them

Is there a way to instruct bazel to list all the targets it has found without building or testing them?

Upvotes: 4

Views: 3004

Answers (2)

PolyGlot
PolyGlot

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

Matt Mackay
Matt Mackay

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

Related Questions