如何引用"bazel"BUILD文件的源目录



我有如下内容:

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"],
…
)

相关内容

最新更新