I have a parent directory foo
, and child directories bar
, baz
, and qux
. All four directories contain a bazel BUILD file and define filegroup
rules that contain all files in the subdirectory (plus various other rules). The problem with this is that the filegroup
in the parent directory foo
cannot use a glob to ensure that all files are included (because globs do not cross package boundaries). Instead, I'm currently manually listing all of the children's rules as srcs
in foo
, and this manual listing is error-prone because when another child of foo
is added, the author must remember to add it to the srcs
of foo
. I tried to make some progress solving this problem by looking at adding a genquery
rule in foo
(thinking I could somehow extract a list of srcs from this programmatically at build time), but recursive patterns are not allowed in the expression
of a genquery
rule, so this was unsuccessful.
What is the least mistake-prone way of creating such a filegroup? Is there anything better than my current manual construction of it by listing srcs
?