Bazel:如何获取输出二进制文件的路径? [英] Bazel: how to get path to output binary?

查看:340
本文介绍了Bazel:如何获取输出二进制文件的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑somepath/BUILD文件:

load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")

proto_library(
    name = "bar_proto",
    srcs = ["bar.proto"],
)

java_proto_library(
    name = "bar_java_proto",
    deps = [":bar_proto"],
)

通过检查bazel-bin文件夹,我发现了bazel-bin/somepath/libbar_proto-speed.jar.

By inspecting bazel-bin folder, I find bazel-bin/somepath/libbar_proto-speed.jar.

如何使用bazel查询从//somepath:bar_java_proto中获取bazel-bin/somepath/libbar_proto-speed.jar?

How do I get bazel-bin/somepath/libbar_proto-speed.jar from //somepath:bar_java_proto using bazel query?

推荐答案

您不知道.

知道输出路径需要执行Bazel的加载和分析阶段,即(1)加载BUILD文件和(2)分析依赖关系以提出执行计划和具体的构建动作(称为动作图").

Knowing output paths requires executing Bazel's loading and analysis phases, i.e. (1) loading the BUILD files and (2) analyzing dependencies to come up with the execution plan and concrete build actions (called the "action graph").

Bazel查询仅运行加载阶段,而不运行分析阶段,因此它不了解输出路径.

Bazel query only runs the loading phase, not the analysis phase, therefore it doesn't know about output paths.

Bazel cquery(配置查询")在分析阶段[1]之后运行,但据我所知它也无法返回输出路径.

Bazel cquery ("configured query") runs after the analysis phase [1], but as far as I understand it also cannot return output paths.

[1] https://docs.bazel.build/versions/master/cquery.html

这篇关于Bazel:如何获取输出二进制文件的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆