将bazel目标路径转换为文件系统路径的可靠方法? [英] Reliable way to convert bazel target path into filesystem path?
问题描述
外部工具是否有可靠的方法来引用Bazel生成的文件?更具体地说:如何将目标路径转换为bazel-bin(或类似路径)路径?
Is there a reliable way for outside tools to reference files generated by Bazel? More specifically: how to I convert target paths into bazel-bin (or so) paths?
我可以确定目标的出局
:
$ bazel query'labels(outs,//bababot:bababot_server_kube_dev_deployment_json)'//bababot:bababot_server_kube_dev_deployment.json
除了我需要字符串 bazel-bin/bababot/bababot_server_kube_dev_deployment.json
或等效代码.
The //bababot:bababot_server_kube_dev_deployment.json
is almost what I need, except that I need the string bazel-bin/bababot/bababot_server_kube_dev_deployment.json
, or equivalent.
我怎样才能可靠地得到它?我想我可以先将//
替换为 bazel info bazel-bin
,然后将:
替换为/
.有没有那么脆的方法?
How can I get that reliably? I imagine that I can start by replacing //
for bazel info bazel-bin
and replacing :
for /
. Is there a less brittle way?
谢谢!
推荐答案
Bazel has a Build Event Protocol, check out the NamedSetOfFiles
events
这篇关于将bazel目标路径转换为文件系统路径的可靠方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!