2024-03-06 19:35:21 +01:00
|
|
|
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
|
|
|
|
|
|
|
|
|
|
# Compile with debug profile
|
|
|
|
|
build-debug *args:
|
|
|
|
|
cargo build {{args}}
|
|
|
|
|
|
|
|
|
|
# Compile with release profile
|
|
|
|
|
build-release *args: (build-debug '--release' args)
|
|
|
|
|
|
|
|
|
|
# Compile with a vendored tarball
|
|
|
|
|
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
|
|
|
|
|
|
|
|
|
|
# Check for errors and linter warnings
|
|
|
|
|
check *args:
|
|
|
|
|
cargo clippy --all-features {{args}} -- -W clippy::pedantic
|
|
|
|
|
|
|
|
|
|
# Runs a check with JSON message format for IDE integration
|
|
|
|
|
check-json: (check '--message-format=json')
|
|
|
|
|
|
|
|
|
|
# Remove Cargo build artifacts
|
2024-03-06 20:03:34 +01:00
|
|
|
[no-cd]
|
2024-03-06 19:35:21 +01:00
|
|
|
clean:
|
|
|
|
|
cargo clean
|
|
|
|
|
|
|
|
|
|
# Also remove .cargo and vendored dependencies
|
2024-03-06 20:03:34 +01:00
|
|
|
[no-cd]
|
2024-03-06 19:35:21 +01:00
|
|
|
clean-dist: clean
|
|
|
|
|
rm -rf .cargo vendor vendor.tar target
|
|
|
|
|
|
|
|
|
|
# Run the application for testing purposes
|
|
|
|
|
run *args:
|
2024-07-31 08:08:34 +02:00
|
|
|
env RUST_LOG=debug RUST_BACKTRACE=full cargo run {{args}} --release
|
2024-03-06 19:35:21 +01:00
|
|
|
|
|
|
|
|
# Run `cargo test`
|
|
|
|
|
test *args:
|
|
|
|
|
cargo test {{args}}
|
|
|
|
|
|
2024-03-06 20:03:34 +01:00
|
|
|
# Vendor Cargo dependencies locally
|
|
|
|
|
[no-cd]
|
|
|
|
|
vendor:
|
|
|
|
|
mkdir -p .cargo
|
2024-07-31 16:39:44 +02:00
|
|
|
cargo vendor | head -n -1 > .cargo/config.toml
|
|
|
|
|
echo 'directory = "vendor"' >> .cargo/config.toml
|
2024-03-06 20:03:34 +01:00
|
|
|
tar pcf vendor.tar vendor
|
|
|
|
|
rm -rf vendor
|
|
|
|
|
|
2024-03-06 19:35:21 +01:00
|
|
|
# Extracts vendored dependencies
|
2024-03-06 20:03:34 +01:00
|
|
|
[no-cd, private]
|
2024-03-06 19:35:21 +01:00
|
|
|
vendor-extract:
|
|
|
|
|
rm -rf vendor
|
|
|
|
|
tar pxf vendor.tar
|