From 6e681292479466083c94cb2b24bd5dfe8db3cb60 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sun, 31 May 2026 12:17:17 +0200 Subject: [PATCH] build: add justfile for common dev and build tasks 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 --- justfile | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 justfile diff --git a/justfile b/justfile new file mode 100644 index 0000000..d2e9527 --- /dev/null +++ b/justfile @@ -0,0 +1,36 @@ +[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