41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
# Shared local/CI Rust checks. Formatting is read-only unless --fix is explicit.
|
|
set -eu
|
|
root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
|
|
usage() {
|
|
cat <<'USAGE'
|
|
Usage: ./dev/check [--fix]
|
|
|
|
Run Rust formatting checks, strict workspace and freestanding Clippy, then
|
|
workspace tests. Default checks do not format source files. --fix formats Rust
|
|
sources first.
|
|
USAGE
|
|
}
|
|
fix=false
|
|
case "$#" in
|
|
0) ;;
|
|
1)
|
|
case "$1" in
|
|
--fix) fix=true ;;
|
|
--help|-h) usage; exit 0 ;;
|
|
*) usage >&2; exit 2 ;;
|
|
esac
|
|
;;
|
|
*) usage >&2; exit 2 ;;
|
|
esac
|
|
cd "$root"
|
|
# The freestanding mount has its own manifest outside the workspace.
|
|
boot=dev/boot/Cargo.toml
|
|
if [ "$fix" = true ]; then
|
|
./dev/cargo fmt --all
|
|
./dev/cargo fmt --manifest-path "$boot" --all
|
|
fi
|
|
./dev/cargo fmt --all -- --check
|
|
./dev/cargo fmt --manifest-path "$boot" --all -- --check
|
|
./dev/cargo clippy --workspace --all-targets --locked -- -D warnings
|
|
# RUSTFLAGS also denies warnings in the runtime crates the mount builds without
|
|
# std; registry dependencies stay lint-capped. Output stays under ignored target/.
|
|
RUSTFLAGS="-D warnings" ./dev/cargo clippy --manifest-path "$boot" --locked \
|
|
--target x86_64-unknown-none --target-dir target/boot -- -D warnings
|
|
./dev/cargo test --workspace --locked
|