tree: b6d441d386ef254bbe55883284a8152a13ad37f1
  1. blaze/
  2. build_event_stream/
  3. command_line/
  4. failure_details/
  5. invocation_policy/
  6. metrics/
  7. option_filters/
  8. action_cache.proto
  9. BUILD.bazel
  10. build_event_stream.proto
  11. command_line.proto
  12. failure_details.proto
  13. invocation_policy.proto
  14. option_filters.proto
  15. package_load_metrics.proto
  16. proto_bundle.bzl
  17. README.md
  18. update_3p_protos.py
third_party/bazel/README.md

Third-party Bazel Protos

This directory contains a subset of Bazel's Build Event Protocol (BEP) and related protocol buffer definitions, vendored here to provide Go bindings for the jobstatus tool without requiring a complex dependency on the full Bazel source tree.

Vendored Protos

The following proto files are vendored here:

  • build_event_stream.proto: The main Build Event Protocol definition.
  • command_line.proto: Representation of Bazel command lines.
  • option_filters.proto: Used by command line representation.
  • invocation_policy.proto: Used by command line representation.
  • failure_details.proto: Structured failure information.
  • action_cache.proto: Action cache statistics.
  • package_load_metrics.proto: Metrics related to package loading.

Why Vendoring?

Directly depending on the @io_bazel module in a Bzlmod environment can introduce transitive dependency conflicts (e.g., rules_graalvm, rules_jvm_external) that are difficult to resolve in a Go-centric project like rsclient. Vendoring just the necessary protos allows us to maintain a stable, isolated build.

Updating Protos

To update these protos from a local Bazel checkout, use the provided script:

# Can be run from any directory:
./rsclient/third_party/bazel/update_3p_protos.py --bazel-source=/path/to/bazel/source

By default, the script looks for Bazel at ../../../bazel.

The script performs the following:

  1. Copies the source .proto files.
  2. Flattens the import paths to be relative to this directory (e.g., third_party/bazel/).
  3. Generates the BUILD.bazel file with appropriate Go proto rules.
  4. Ensures consistency between the physical file layout and the import statements.

Go Bindings

Go bindings are generated via the go_proto_library targets defined in BUILD.bazel. The generated code is mapped to the github.com/bazelbuild/rsclient/third_party/bazel/... import paths.