← 返回命令列表

Linux command

buck 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Build a target

buck build //[path/to:target]

Run a binary target

buck run //[path/to:target]

Run tests

buck test //[path/to:target]

Query target dependencies

buck query "deps(//[path/to:target])"

List all targets

buck targets //[path/to/package]:

Build with specific configuration

buck build //[target] --config [section.option=value]

Clean build artifacts

buck clean

Show build output path

buck build //[target] --show-output

说明

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.

参数

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).
--show-full-output
Show full output paths including hash.
--help
Show help information.

FAQ

What is the buck command used for?

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.

How do I run a basic buck example?

Run `buck build //[path/to:target]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does build _targets_ do in buck?

Build specified targets.