mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
komorebi for KDE is built up as a Cargo workspace with one crate per concern, the way komorebi and komorebi for Mac are. The first two crates are the `komorebi` daemon, which does nothing yet but report its version, and `version`, which owns the string every binary of the workspace reports. `version` reads the commit from git when HEAD is on a branch, and from COMMIT_HASH otherwise. A jj workspace leaves HEAD detached, so `.cargo/config.toml` defaults the variable to `unknown` (nix will set the real commit), and a plain `cargo build` in a jj checkout compiles. The tooling files come from komorebi for Mac: the licence, deny.toml (trimmed to the licences in use), rustfmt.toml and the toolchain file. `just check` runs the formatting check, clippy and rustdoc with warnings denied, and the tests. rustfmt.toml uses an unstable option, so formatting needs a nightly rustfmt. The `rg` calls in `just lint` name a path because rg reads stdin when it is given none and stdin is not a terminal. The README and CONTRIBUTING.md say how to run, check and commit.
22 lines
806 B
Makefile
22 lines
806 B
Makefile
export RUST_BACKTRACE := "full"
|
|
|
|
# format the Rust sources (needs a nightly rustfmt: rustfmt.toml uses unstable options)
|
|
fmt:
|
|
cargo fmt
|
|
|
|
# everything a change has to pass before it is pushed
|
|
check: lint
|
|
cargo fmt --check
|
|
cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
cargo test --workspace --locked
|
|
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
|
|
|
|
# the macros the codebase has agreed not to use
|
|
lint:
|
|
test -z "$(rg 'eyre!' --type rust .)" || (echo "eyre! macro not allowed"; false)
|
|
test -z "$(rg 'dbg!' --type rust .)" || (echo "dbg! macro not allowed"; false)
|
|
test -z "$(rg 'println!' --type rust ./komorebi/src)" || (echo "println! macro not allowed"; false)
|
|
|
|
run target *args:
|
|
cargo run --bin {{ target }} --locked -- {{ args }}
|