Seamlessly build Cargo packages with Buck2.
cargo install --git https://github.com/buck2hub/cargo-buckal.git
Run cargo buckal --help for full usage.
Common commands:
cargo buckal init: initialize a Buck2-enabled workspace in an existing directorycargo buckal migrate: migrate an existing Cargo workspace to Buck2 (generate/update BUCK files)cargo buckal build: build the current package with Buck2cargo buckal new|add|remove|update|autoremove: manage Cargo dependenciescargo buckal clean: cleanbuck-outdirectorycargo buckal version: print version information
Platform-aware dependency mapping and bundled sample platforms currently target these Rust tier-1 host triples:
- Linux:
x86_64-unknown-linux-gnu - Windows:
x86_64-pc-windows-msvc - macOS:
aarch64-apple-darwin
cargo buckal migrate preserves platform-conditional Cargo dependencies by emitting os_deps/os_named_deps and canonical OS constraints, so the same generated BUCK files can be built for different target platforms without regenerating on each host.
You can configure cargo-buckal by creating a configuration file at ~/.config/buckal/config.toml.
If you have buck2 installed in a custom location, you can specify the path:
buck2_binary = "/path/to/your/buck2"If no configuration file exists, cargo-buckal will use buck2 (searches your PATH).
This project uses prek for pre-commit hooks (configured in .pre-commit-config.yaml).
Install prek following the project instructions, then set up the git hooks:
prek install
To run hooks on all files at any time:
prek run --all-files
