Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you query for a list of all repositories that are available in a WORKSPACE?

Tags:

bazel

Is it possible to use bazel query to get a list of all remote repositories (e.x. @com_google_protobuf) that are available?

like image 608
achew22 Avatar asked Sep 15 '17 00:09

achew22


1 Answers

I don't know of any way to get exactly this, however you can get an overapproximation by querying the synthetic //external package. It contains one target for every external repository. However, it contains some other targets by default.

Example:

$ cat WORKSPACE
local_repository(name = "a", path = "a")
maven_jar(name = "b", artifact = "com.google.guava:guava:19.0")

$ bazel query //external:all
//external:local_jdk
//external:local_config_xcode
//external:local_config_cc
//external:jre-default
//external:jre
//external:jni_md_header-linux
//external:jni_md_header-freebsd
//external:jni_md_header-darwin
//external:jni_header
//external:jdk-default
//external:jdk
//external:javac
//external:java
//external:jar
//external:has_androidsdk
//external:extdir
//external:extclasspath
//external:cc_toolchain
//external:bootclasspath
//external:bazel_tools
//external:bazel_j2objc
//external:b
//external:android_sdk_for_testing
//external:android_ndk_for_testing
//external:android/sdk
//external:android/dx_jar_import
//external:android/crosstool
//external:a

Note that //external:a and //external:b appear in the results.

like image 186
Adam Avatar answered Oct 18 '22 09:10

Adam