Bazel / Buck2 / Pants
Bazel, Buck2, and Pants are hermetic build systems originally developed by Google, Meta, and Toolchain respectively to handle the scale and correctness requirements of massive monorepos.
- ·Advanced build system (Bazel, Buck2, or Pants) is adopted for primary codebase
- ·Remote execution (EngFlow or equivalent) distributes build steps across multiple machines
- ·Incremental builds run only changed targets (not full rebuild)
- ·BUILD file maintenance is assigned to specific team members or automated
- ·Remote cache hit rate exceeds 80%
Evidence
- ·Bazel/Buck2/Pants BUILD files in repository
- ·Remote execution configuration (EngFlow, BuildBuddy, or equivalent)
- ·Build log showing incremental target selection
What It Is
Bazel, Buck2, and Pants are hermetic build systems originally developed by Google, Meta, and Toolchain respectively to handle the scale and correctness requirements of massive monorepos. Unlike Maven or Gradle, they require developers to explicitly declare every dependency in BUILD files - every source file, every library, every generated artifact has a declared rule. This explicitness is what enables their core properties: hermeticity (builds don't depend on the host environment), correctness (a build with the same inputs always produces the same outputs), and fine-grained incrementality (only the targets that actually depend on a changed file are rebuilt).
Hermetic builds are the foundation of reliable incremental compilation. When the build system knows the complete, precise dependency graph of every file in the repository, it can determine exactly which targets need to be rebuilt when a source file changes. If you change a utility function in a leaf library with 3 dependents, only those 3 targets rebuild - not the entire codebase. This is categorically different from Maven's module-level incremental compilation, which still recompiles entire modules when any file within them changes.
Buck2 is Meta's reimplementation of Buck in Rust, released as open source in 2023. It addresses several limitations of the original Buck and competes directly with Bazel for teams starting fresh. Pants is a newer entrant focused on Python monorepos and data science workflows. Bazel has the largest ecosystem, the most integrations, and the longest track record. The choice between them depends on language ecosystem, existing tooling, and team familiarity - but all three deliver the same core value: hermetic, incremental, distributable builds.
The migration cost from Maven/Gradle to Bazel is substantial. Writing BUILD files for a large existing codebase takes weeks to months. The tooling ecosystem is smaller. Developer education is required. Organizations at L3 accept this cost because the payoff at scale is significant: near-instant incremental builds regardless of codebase size, the ability to distribute builds across a cluster, and a build system that can support hundreds of parallel agents each making independent changes.
Why It Matters
- True fine-grained incrementality - change one file, rebuild only the targets that directly or transitively depend on it, regardless of module structure; this is the property that makes builds fast for agent iteration
- Hermetic builds eliminate "works on my machine" - agents running on different machines, CI runners with different configurations, and developer laptops all produce identical outputs for identical inputs
- Remote execution is native - Bazel's remote execution protocol (REAPI) is a standard interface that connects to EngFlow, BuildBuddy, and other distributed build backends; you can't effectively use remote execution without a build system that supports it
- Monorepo at any scale - Google runs Bazel on a repository with billions of lines of code; the incremental build properties don't degrade as the codebase grows, which is critical for organizations building a large codebase with many parallel agents
- Dependency correctness is enforced - BUILD files require explicit dependency declarations; circular dependencies, implicit dependencies, and undeclared inputs that silently corrupt caches in Maven/Gradle become build errors in Bazel
Getting Started
6 steps to get from here to the next level
Common Pitfalls
Mistakes teams actually make at this stage - and how to avoid them
How Different Roles See It
Bob's teams have been running agents at scale for six months and build time has emerged as a consistent bottleneck. L2 optimizations (caching, parallel steps, dedicated runners) have helped but hit a ceiling: warm builds are 90 seconds, cold CI builds are 8 minutes. His engineering leads are suggesting a migration to Bazel. Bob is skeptical of the migration cost.
What Bob should do - role-specific action plan
Sarah has been tracking developer-reported friction points and "waiting for builds" consistently appears in the top 3. Developers running agents have learned to batch their agent reviews in 90-second intervals synchronized with build completion. This "build-paced workflow" is a sign that the build system is dictating the agent interaction rhythm - exactly what shouldn't happen.
What Sarah should do - role-specific action plan
Victor has been running Bazel in his personal projects and has built a prototype Bazel BUILD configuration for his team's main service. The prototype demonstrates 8-second incremental builds versus the current 90-second Gradle builds for a one-line change. He wants to make the case for a team-wide migration.
What Victor should do - role-specific action plan
Further Reading
5 resources worth reading - hand-picked, not scraped
From the Field
Recent releases, projects, and discussions relevant to this maturity level.
Build System