11#!/ usr/ bin/ env just --justfile
22
3- main_crate := ' tilejson'
4- features_flag := ' --all-features'
3+ main_crate := file_name (justfile_directory ())
4+ packages := ' --workspace' # All crates in the workspace
5+ features := ' --all-features' # Enable all features
6+ targets := ' --all-targets' # For all targets (lib, bin, tests, examples, benches)
57
68# if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set
79# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
@@ -19,11 +21,11 @@ export RUST_BACKTRACE := env('RUST_BACKTRACE', if ci_mode == '1' {'1'} else {''}
1921
2022# Build the project
2123build :
22- cargo build --workspace --all-targets {{ features_flag }}
24+ cargo build {{ packages }} {{ features }} {{ targets }}
2325
2426# Quick compile without building a binary
2527check :
26- cargo check --workspace --all-targets {{ features_flag }}
28+ cargo check {{ packages }} {{ features }} {{ targets }}
2729
2830# Generate code coverage report to upload to codecov.io
2931ci-coverage : env-info && \
@@ -44,19 +46,19 @@ clean:
4446
4547# Run cargo clippy to lint the code
4648clippy * args :
47- cargo clippy --workspace --all-targets {{ features_flag }} {{ args}}
49+ cargo clippy {{ packages }} {{ features }} {{ targets }} {{ args}}
4850
4951# Generate code coverage report. Will install `cargo llvm-cov` if missing.
5052coverage * args = ' --no-clean --open': (cargo-install ' cargo-llvm-cov' )
51- cargo llvm-cov --workspace --all-targets {{ features_flag }} --include-build-script {{ args}}
53+ cargo llvm-cov {{ packages }} {{ features }} {{ targets }} --include-build-script {{ args}}
5254
5355# Build and open code documentation
5456docs * args = ' --open':
55- DOCS_RS=1 cargo doc --no-deps {{ args}} --workspace {{ features_flag }}
57+ DOCS_RS=1 cargo doc --no-deps {{ args}} {{ packages }} {{ features }}
5658
5759# Print environment info
5860env -info:
59- @ echo " Running {{ if ci_mode == ' 1' {' in CI mode' } else {' in dev mode' } }} on {{ os ()}} / {{ arch ()}} "
61+ @ echo " Running for ' {{ main_crate }} ' crate {{ if ci_mode == ' 1' {' in CI mode' } else {' in dev mode' } }} on {{ os ()}} / {{ arch ()}} "
6062 @ echo " PWD $(pwd)"
6163 {{ just_executable ()}} --version
6264 rustc --version
8082
8183# Reformat all Cargo.toml files using cargo-sort
8284fmt-toml * args : (cargo-install ' cargo-sort' )
83- cargo sort --workspace --grouped {{ args}}
85+ cargo sort {{ packages }} --grouped {{ args}}
8486
8587# Get any package's field from the metadata
8688get-crate-field field package = main_crate: (assert-cmd ' jq' )
@@ -91,20 +93,20 @@ get-msrv package=main_crate: (get-crate-field 'rust_version' package)
9193
9294# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml
9395msrv : (cargo-install ' cargo-msrv' )
94- cargo msrv find --write-msrv --ignore-lockfile {{ features_flag }}
96+ cargo msrv find --write-msrv --ignore-lockfile {{ features }}
9597
9698# Run cargo-release
9799release * args = ' ': (cargo-install ' release-plz' )
98100 release-plz {{ args}}
99101
100102# Check semver compatibility with prior published version. Install it with `cargo install cargo-semver-checks`
101103semver * args : (cargo-install ' cargo-semver-checks' )
102- cargo semver-checks {{ features_flag }} {{ args}}
104+ cargo semver-checks {{ features }} {{ args}}
103105
104106# Run all unit and integration tests
105107test :
106- cargo test --workspace --all-targets {{ features_flag }}
107- cargo test --workspace -- doc {{ features_flag }}
108+ cargo test {{ packages }} {{ features }} {{ targets }}
109+ cargo test --doc {{ packages }} {{ features }}
108110
109111# Test documentation generation
110112test-doc : (docs ' ' )
@@ -115,7 +117,7 @@ test-fmt: && (fmt-toml '--check' '--check-format')
115117
116118# Find unused dependencies. Install it with `cargo install cargo-udeps`
117119udeps : (cargo-install ' cargo-udeps' )
118- cargo + nightly udeps --workspace --all-targets {{ features_flag }}
120+ cargo + nightly udeps {{ packages }} {{ features }} {{ targets }}
119121
120122# Update all dependencies, including breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
121123update :
0 commit comments