How do I query for targets visible from a specific targets?

122 Views Asked by At

Bazel uses the concept of visibility to limit which targets can depend on which targets. Given a target //my:foo, I am looking for a way to query Bazel for a list of targets visible to //my:foo.

Basically, I am trying to figure out which targets in the workspace the target //my:foo can depend on. Any idea if this is possible at all?

1

There are 1 best solutions below

0
Benjamin Peterson On BEST ANSWER

Query has a visible function. So, bazel query 'visible(//my:foo, //...)' prints all the targets that //my:foo may depend on.