Welcome to the Bazel repository. This document provides essential context and workflows for working with the Bazel codebase.
To build Bazel from source, use a pre-installed bazel or bazelisk binary.
bazel build //src:bazel-devbazel build //src:bazel--config=remote to significantly speed up your builds:bazel build --config=remote //src:bazel-dev
To test changes safely without interfering with your primary workspace, use a separate binary and output base:
bazel build //src:bazel-dev && cp bazel-bin/src/bazel-dev /tmp/bazel
/tmp/bazel --output_base=/tmp/ob-dev <command>
Note: Using a custom --output_base (e.g., /tmp/ob-dev) is crucial to avoid locking your main workspace server and ensures your development environment remains isolated.
Tests are located primarily in src/test.
If you modify a file, find tests that transitively depend on it:
bazel query "rdeps(//src/test/..., path/to/file.java)"
java_test targets.BuildIntegrationTestCase.src/test/shell, using a bash test framework.Bazel uses a Client/Server architecture. The client (C++) is a lightweight wrapper that starts and communicates with a long-lived Java server.
SkyFunctions evaluating SkyKeys into SkyValues.BUILD and .bzl files.For architectural details or introspection capabilities, see: docs/contribute/codebase.mdx
buildifier for BUILD and .bzl files.