TL;DR:
Is there a way to create a filegroup which will contain, in the same directory, files from multiple source directories plus the output of a genrule()?
I have a project I'm slowly working to convert to Bazel. I think the last major remaining issues can be addressed if I can get filegroups (and some trivial genrules) to do what I want. But I'm not able to easily figure out how to get filegroups to do what I want/need.
The main challenge I have is in feeding a bunch of files to the Linux kernel kbuild system for building out-of-tree kernel modules.
I've managed to make most of this work by wrapping the Kbuild call into a foreign_cc make() wrapper call. With enough environment variable substitution I'm able to at least convert some .c files into .o files.
The challenge now is that the make() wrapper only accepts a single filegroup and that Kbuild requires all files to be in the same directory.
I have a directory structure that looks like:
common/file1.c
common/file2.c
kernel/file3.c
kernel/file4.c
kernel/Kbuild
In the existing make-based buildsystem, the
file_requiring_preprocessing.in is handled by a few sed statements. That output, plus the files from the common/ and kernel/ directories are symlinked into a separate build directory. Inside the build directory the kernel kbuild system is triggered and the kernel module is built.
I can obviously replace the existing sed statements via genrule(). And calling the kbuild can be handled via the make() wrapper. I'm left with putting everything in the same directory.
Is there a way to create a filegroup which will contain, in the same directory, files from multiple source directories plus the output of a genrule()?
Thank you!