6e68129247
Introduce a justfile to standardize the project's everyday commands so
contributors no longer need to remember the exact cargo invocations and
flags. Until now these commands lived only in shell history and memory,
which made the non-obvious ones (the LTO profile, the native install
incantation) easy to get wrong.
Recipes provided:
- dev (default): cargo run with passthrough args
- fmt: nightly rustfmt + tombi for TOML + just --fmt, mirroring the
formatting already applied in recent commits (e.g. fc851e8)
- clippy: lint the whole workspace, all targets
- build / build-release / build-production: the three build tiers, with
build-production using the release-lto profile defined in Cargo.toml
- install: install targeting the native CPU and x86_64-unknown-linux-gnu
via the release-lto profile, force-overwriting any existing binary
- clean: cargo clean
The fmt and install recipes depend on external tools (fd, tombi, nightly
toolchain); these are assumed present in the dev environment and are not
auto-installed here.
Test Plan:
- `just --list` lists all recipes without parse errors
- `just --unstable --fmt --check` reports the file is already formatted
- `just build` and `just clippy` succeed against the current tree
37 lines
840 B
Makefile
37 lines
840 B
Makefile
[private]
|
|
default: dev
|
|
|
|
# Run the program with optional arguments
|
|
dev *args:
|
|
cargo run -- {{ args }}
|
|
|
|
# Run fmt on Rust source files and TOML files
|
|
fmt:
|
|
cargo +nightly fmt
|
|
fd -e toml -x tombi format --quiet
|
|
just --fmt
|
|
|
|
# Run clippy on all workspace packages, tests, and examples
|
|
clippy:
|
|
cargo clippy --workspace --all-targets
|
|
|
|
# Run the default build
|
|
build:
|
|
cargo build
|
|
|
|
# Run a release debug build
|
|
build-release:
|
|
cargo build --release
|
|
|
|
# Run a production build with link-time optimization (LTO)
|
|
build-production:
|
|
cargo build --profile release-lto
|
|
|
|
# Install the binary targeting native target-cpu and x86_64-unknown-linux-gnu
|
|
install:
|
|
RUSTFLAGS="-C target-cpu=native" cargo install --path . --target x86_64-unknown-linux-gnu --profile release-lto --force
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
cargo clean
|