Shu Zhang
Shu Zhang

Reputation: 41

how to make a bazel target depend on all targets inside another BUILD file

I have a use case, that for the deps of a target, i need to depend on all targets of another BUILD file. that BUILD file has about 100 targets so it's not realistic for me to write down all of them, is there a quicker way to specify the dependencies?

Upvotes: 4

Views: 1750

Answers (1)

zlalanne
zlalanne

Reputation: 914

You could create a macro that loops through all existing rules in a BUILD file and creates a filegroup for it. The other BUILD file would depend on this filegroup.

The bazel docs have a stub example that finds all cc_library rules and aggregates them together.

Upvotes: 5

Related Questions