简体   繁体   English

bazel build - 如何获取临时目录的名称

[英]bazel build - how to get name of temporary directory

I am running bazel build using the environment variable:我正在使用环境变量运行 bazel build:

TEST_TMPDIR=/tmp/.bazel

(This way it does not use ~/.cache/bazel and instead uses /tmp/.bazel) (这种方式不使用 ~/.cache/bazel 而是使用 /tmp/.bazel)

After the build completes, I can do:构建完成后,我可以执行以下操作:

ls -lah /tmp/.bazel/_bazel_dev/
total 20K
drwxr-xr-x 5 dev root 4.0K Dec 15 13:26 .
drwxr-xr-x 3 dev root 4.0K Dec 15 13:26 ..
drwxr-xr-x 3 dev root 4.0K Dec 15 13:26 cache
drwxr-xr-x 8 dev root 4.0K Dec 15 13:36 f0dfd1906214c4c442535f524f4c9395
drwxr-xr-x 3 dev root 4.0K Dec 15 13:26 install

Now is there a bazel command (or bash commands) I can run to get the temp dir name?现在是否有一个 bazel 命令(或 bash 命令)我可以运行以获取临时目录名称? f0dfd1906214c4c442535f524f4c9395 f0dfd1906214c4c442535f524f4c9395

If there are multiple such folders from builds of other unrelated projects also, I just want to get the dir name for my bazel build.如果其他不相关项目的构建中也有多个这样的文件夹,我只想获取我的 bazel 构建的目录名称。

(The reason I need this is because I need some files from this directory for another build) (我需要这个的原因是因为我需要这个目录中的一些文件来进行另一个构建)

You want the output from bazel info您想要来自bazel info的 output

Most likely you are after the output_base path but you should be able to find all the other paths you need from the output of that command.您很可能在output_base路径之后,但您应该能够从该命令的 output 中找到所需的所有其他路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM