LinuxCommandLibrary

buck

TLDR

Build a target

$ buck build //[path/to:target]
copy
Run a binary target
$ buck run //[path/to:target]
copy
Run tests
$ buck test //[path/to:target]
copy
Query target dependencies
$ buck query "deps(//[path/to:target])"
copy
List all targets in a package
$ buck targets //[path/to/package]:
copy
Build with specific configuration
$ buck build //[target] --config [section.option=value]
copy
Clean build artifacts
$ buck clean
copy
Show build output path
$ buck build //[target] --show-output
copy

SYNOPSIS

buck command [options] [targets]
buck2 command [options] [targets]

DESCRIPTION

Buck is a fast, multi-language build system developed by Facebook (Meta). It uses a dependency graph to determine which targets need rebuilding, enabling incremental builds. Buck2 is the rewritten successor with improved performance.
Build rules are defined in BUCK files (or BUILD for Buck2) using a Python-like syntax. Targets are referenced using the //path/to/package:name convention. Buck caches build artifacts and can distribute builds across machines.
Buck supports many languages including C++, Java, Python, Go, Rust, and others through its extensible rule system. It's designed for large monorepo codebases with complex dependency graphs.

PARAMETERS

build targets

Build specified targets.
run target
Build and run a binary target.
test targets
Build and run tests.
clean
Delete build artifacts.
targets pattern
List targets matching pattern.
query expression
Query the target graph.
audit subcommand
Audit build configuration.
install target
Build and install (mobile apps).
--config key=value
Override configuration values.
--show-output
Show output file paths.
--no-cache
Ignore cached results.
-j jobs
Number of parallel jobs.
-v verbosity
Verbosity level (0-10).
--help
Show help information.

CAVEATS

Requires Java runtime (Buck1) or standalone binary (Buck2). Build files must be in specific format. Large dependency graphs can cause slow initial analysis. Remote execution setup requires additional infrastructure. Buck2 is not fully backward compatible with Buck1.

HISTORY

Buck was developed at Facebook starting around 2013 to handle the company's large codebase. It was open-sourced and used by companies like Uber and Airbnb. Buck2 was announced in 2022 as a complete rewrite in Rust, offering significant performance improvements. Buck2 was open-sourced in April 2023 and is now the recommended version.

SEE ALSO

bazel(1), make(1), ninja(1), gradle(1)

Copied to clipboard