facebook / buck2
- понедельник, 10 апреля 2023 г. в 00:14:19
Build system, successor to Buck
This repo contains the code for the Buck2 build system - the successor to the original Buck build system.
We're keen for you to give Buck2 a go and let us know any problems you run into.
Buck2 is written in Rust, which requires rustup to compile.
You can either build buck2 from a clone of the Buck2 repo:
git clone https://github.com/facebook/buck2.git
cd buck2/
cargo install --path=app/buck2Or alternatively install it directly from GitHub:
rustup install nightly-2023-01-24
cargo +nightly-2023-01-24 install --git https://github.com/facebook/buck2.git buck2Build uses prebuilt protoc binary from
protoc-bin-vendored crate.
If these binaries to do not work on your machine (for example, when building for NixOS),
path to protoc binary and protobuf include path can be specified via
BUCK2_BUILD_PROTOC and BUCK2_BUILD_PROTOC_INCLUDE environment variables.
To build a project with buck2, go to the getting started guide.
Frequently used terms and their definitions can be found in the glossary page.
Beyond the obvious (well-tested, easy to read) we prefer guidelines that are automatically enforced, e.g. through rust fmt, Clippy or the custom linter we have written. Some rules:
dupe.to_owned to convert &str to String.anyhow::Result rather than use anyhow::Result.anyhow::Result. Inspecting errors outside tests and the top-level error handler is strongly discouraged.thiserror deriving enum values, not raw anyhow!.derivative library to derive the PartialEq and Hash traits when some fields should be ignored.use crate::foo::bar over use super::bar or use crate::foo::*, apart from test modules which often have use super::* at the top.anyhow::Error for checking internal invariants that are maintained between multiple files, while panic!/unreachable! are reasonable if the invariant is file-local.Variable `x` not defined.Available targets: [`aa`, `bb`].Buck2 is both MIT and Apache License, Version 2.0 licensed, as found in the LICENSE-MIT and LICENSE-APACHE files.