This page describes the various folders and symlinks that Bazel generates.
I am interested in this one:
external/ <== The directory that remote repositories are
downloaded/symlinked into.
I would also like to get two things:
I think that (2) follows this pattern: bazel-my-project/external
How can I get these paths from the Bazel CLI?
Use $(bazel info output_base)/external
. $(bazel info execution_root)/external
may not always work, since the execution root can be ephemeral as a symlink tree. The latter just contains symlinks to the former:
$ ls -al $(bazelisk info output_base)/execroot/__main__/external
total 44
drwxr-x--- 2 jingwen primarygroup 4096 Jul 6 12:51 .
drwxr-x--- 5 jingwen primarygroup 4096 Jul 6 12:51 ..
lrwxrwxrwx 1 jingwen primarygroup 112 Jul 6 12:51 bazel_tools -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/bazel_tools
lrwxrwxrwx 1 jingwen primarygroup 116 Jul 6 12:51 local_config_cc -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/local_config_cc
lrwxrwxrwx 1 jingwen primarygroup 110 Jul 6 12:51 local_jdk -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/local_jdk
lrwxrwxrwx 1 jingwen primarygroup 106 Jul 6 12:51 maven -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/maven
lrwxrwxrwx 1 jingwen primarygroup 110 Jul 6 12:51 platforms -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/platforms
lrwxrwxrwx 1 jingwen primarygroup 122 Jul 6 12:51 remote_coverage_tools -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/remote_coverage_tools
lrwxrwxrwx 1 jingwen primarygroup 118 Jul 6 12:51 remote_java_tools -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/remote_java_tools
lrwxrwxrwx 1 jingwen primarygroup 124 Jul 6 12:51 remote_java_tools_linux -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/remote_java_tools_linux
lrwxrwxrwx 1 jingwen primarygroup 118 Jul 6 12:51 remotejdk11_linux -> /home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external/remotejdk11_linux
If you just want to rely on the workspace symlinks, you can use readlink
on the bazel-out
symlink:
$ realpath $(readlink -f bazel-out)/../../../external
/home/jingwen/.cache/bazel/_bazel_jingwen/e375750af2fc236b3604a3cb5bfe4b91/external