我有如下内容:
sh_binary(
…
args = [
"path/to/this/build/file/relative/to/workspace/root",
],
…
)
有没有一种方法可以计算/生成"path/to/this/build/file/relative/to/workspace/root"
,这样如果移动BUILD
文件,就不必更改args
?类似于$(location)
的东西(我还没有让$(location)
工作,因为它会引入循环依赖关系(?
将BUILD
文件添加为数据依赖项可以获得其$(location)
:
sh_binary(
…
args = ["$(location BUILD.bazel)"],
data = ["BUILD.bazel"],
…
)