Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

bazel

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?

like image 455
Shu Zhang Avatar asked Sep 16 '25 21:09

Shu Zhang


1 Answers

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.

like image 120
zlalanne Avatar answered Sep 19 '25 15:09

zlalanne



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!