Open sourceActive

Buck2

Buck2 is a fast build system that can be installed from prebuilt binaries or built from source using Rust nightly.

Open source page ↗

Field note

What it does

Buck2 is a build system developed by Facebook. This page provides installation instructions: download prebuilt binaries from the latest release, use dotslash for repositories, or build from source with Rust nightly via rustup or Nix. It also covers protoc requirements for non-Tier-1 platforms and bootstrapping with Buck2 itself.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

cli

Rust / Not filed

Product features

Product features

Advanced language support

Supports features for Haskell, OCaml, and Rust beyond Buck1, like stub headers and pipelining.

Anonymous Targets

Create graphs with more sharing than the original user graph.

Bootstrapping

Build Buck2 with Buck2 using reindeer and buckify.

BUCK files

Write BUCK files to define rules.

BXL

Use BXL for advanced build operations with a context type.

Correctness by default

Rules are hermetic by default, missing dependencies are errors, leading to fewer surprises.

Critical path optimization

Buck2 is significantly closer to the critical path when there is real work to do, with benchmarks showing 5% to 42% faster.

Cross-platform

Runs on Windows, Linux, and macOS, and builds for Android, iOS, and others.

Dependency Queries

Use queries to explore and understand dependency relationships.

Dynamic Dependencies

Rules can build a file then read it to determine further dependencies.

Extensibility

Add new language support via custom build rules and toolchains.

Fast incremental builds

Buck2 makes 'buck build' with nothing to do take 0.1 seconds vs 23 seconds in Buck1.

Faster rule development

Latest Release

Prebuilt executables available from the latest release page.

Low Incremental Build Time

Efficiently rebuilds only necessary parts after small changes.

Monorepo Support

Designed for large monorepos.

Multi-language Composability

Supports mixing languages like Python, Rust, C in a single build.

Multi-language Support

Build projects in C++, Rust, Python, Go, OCaml, Erlang, and more.

Nix Develop

Use flake.nix to get a development shell with cargo and rustc.

Protoc Support

Prebuilt protoc on Tier-1 platforms; env vars for others.

Reindeer integration

Uses Reindeer to automatically generate BUCK files for crates.io dependencies.

Remote Execution First

Local execution is a special case of remote execution.

Rule definitions

Define rules using Starlark standard functions and build functions like rule and attrs.

Rustup Install

Install via cargo with nightly Rust toolchain.

Self-bootstrapping

Buck2 can be built with Cargo or itself, using DotSlash files for quick self-bootstrap.

Shared cache contributions

With Buck2, everyone writes to the cache through sandboxed remote execution, increasing cache hits.

Standard Rules

Provides standard rules available in Buck2.

Starlark APIs

Buck2 is driven by Starlark APIs, a subset of Python.

Target Querying

Build defined as queryable targets in BUCK files.