Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bazel

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

like image 663
rohitsan Avatar asked Sep 01 '25 21:09

rohitsan


1 Answers

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.

like image 71
Matt Mackay Avatar answered Sep 08 '25 09:09

Matt Mackay