How can I reference files inside a directory path given by a genrule? I'm trying the following but it doesn't seem to work:
http_file(
name = "some_file",
...
)
genrule(
name = "zip_structure",
srcs = [":some_file"],
bash = 'mkdir -p ${OUT}/bin; cp ${SRCS} ${OUT}/bin;',
out = "zip_contents",
)
zip_file(
name = "my_zip",
srcs = glob(["$(location :zip_structure)/**/*"]), # does not work
# srcs = glob(["$(location :zip_structure)/*"]), # does not work either
# srcs = glob([":zip_structure/**/*"]), # does not work either
)
I'm basically trying to make a folder structure with a bin folder containing an file. I want to zip that bin folder.
The problem is that if I reference :zip_structure directly, the out folder of :zip_structure (in this case zip_contents) gets included as the root folder inside the structure of the final zip.
A workaround would be naming the out folder of the genrule to bin, that way bin is the root folder inside the generated zip, but it doesn't seem like a proper approach, since I'm only outputting one of the inner folders of the potentially more complex structure.
Check out extract function from buckaroo. Code. Usage example.