I wanted to make a BUILD rule that depends on a data file which is generated from other files. I tried to write something like this:
genrule(
name = "data",
outs = ["MyApp/data.dat"],
cmd = "cd ../libpackfiles ; bazel run FilePacker $(PWD)/../apps/MyApp/data.dat $(PWD)/../apps/MyApp/dataFiles",
)
But it didn't work for many reasons. $(PWD) was not recognized by the genrule (the cmd works fine in an equivalent sh script). And I don't know if I am allowed to leave my workspace directory (which is called apps) to do another bazel run command like this.
How could I write a correct genrule that achieves what I want?
Thanks!