找到Bazel输出文件?
当我运行Bazel Build
时,Bazel报告了目标的输出文件。我该如何编程查询?
在此示例中,我想获得bazel-out /...路径。
$ bazel build foo/bar:registration
INFO: Analyzed target //foo/bar:registration (546 packages loaded, 13485 targets configured).
INFO: Found 1 target...
Target //foo/bar:registration up-to-date:
bazel-out/k8-fastbuild-ST-a82eca4c6b7c/bin/foo/bar/registration/registration_/registration
When I run bazel build
, bazel reports the target's output file. How can I programmatically query this?
In this example, I want to get the bazel-out/...
path.
$ bazel build foo/bar:registration
INFO: Analyzed target //foo/bar:registration (546 packages loaded, 13485 targets configured).
INFO: Found 1 target...
Target //foo/bar:registration up-to-date:
bazel-out/k8-fastbuild-ST-a82eca4c6b7c/bin/foo/bar/registration/registration_/registration
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通过使用
cquery
命令的 starlark”> starlark输出模式。例如,要获得类似于构建
发出的输出,请使用:将来 ,
cquery
也可能有一个专用选项,可以处理简单的情况,而无需在命令行上涉及Starlark。This can be accomplished with great flexibility by using the
cquery
command's Starlark output mode. For instance, to obtain output similar to that emitted bybuild
, use:In the future, there may also be a dedicated option in
cquery
that handles the simple cases without the need to involve Starlark on the command line.更新:自Bazel 5.3以来,确实有一种较短的方法。
Update: there's indeed a shorter way since Bazel 5.3.