bazel queries Last updated Sept 21, 2023

Bazel includes a powerful query engine.

examples

external repos

  • $ bazel query 'kind(local_repository, //external:*)'

  • $ bazel query 'kind(http_archive, //external:*)'

  • $ bazel query 'kind(.*, //external:*)'

  • $ ls $(bazel info output_base)/external/

providers

bazel cquery //path/to:tgt --output=starlark --starlark:expr="[p for p in providers(target)]"
bazel run @obazl//inspect:providers --@obazl//tgt=//interop/ffi/case110:Main