Skip to content

Commit 9c1cc35

Browse files
committed
chore(just): minor justfile cleanup
1 parent 8b65f24 commit 9c1cc35

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

justfile

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/usr/bin/env just --justfile
22

3-
main_crate := 'bindgen_helpers'
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.
@@ -23,11 +25,11 @@ bless *args: (cargo-install 'cargo-insta')
2325

2426
# Build the project
2527
build:
26-
cargo build --workspace --all-targets {{features_flag}}
28+
cargo build {{packages}} {{features}} {{targets}}
2729

2830
# Quick compile without building a binary
2931
check:
30-
cargo check --workspace --all-targets {{features_flag}}
32+
cargo check {{packages}} {{features}} {{targets}}
3133

3234
# Generate code coverage report to upload to codecov.io
3335
ci-coverage: env-info && \
@@ -48,19 +50,19 @@ clean:
4850

4951
# Run cargo clippy to lint the code
5052
clippy *args:
51-
cargo clippy --workspace --all-targets {{features_flag}} {{args}}
53+
cargo clippy {{packages}} {{features}} {{targets}} {{args}}
5254

5355
# Generate code coverage report. Will install `cargo llvm-cov` if missing.
5456
coverage *args='--no-clean --open': (cargo-install 'cargo-llvm-cov')
55-
cargo llvm-cov --workspace --all-targets {{features_flag}} --include-build-script {{args}}
57+
cargo llvm-cov {{packages}} {{features}} {{targets}} --include-build-script {{args}}
5658

5759
# Build and open code documentation
5860
docs *args='--open':
59-
DOCS_RS=1 cargo doc --no-deps {{args}} --workspace {{features_flag}}
61+
DOCS_RS=1 cargo doc --no-deps {{args}} {{packages}} {{features}}
6062

6163
# Print environment info
6264
env-info:
63-
@echo "Running {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
65+
@echo "Running for '{{main_crate}}' crate {{if ci_mode == '1' {'in CI mode'} else {'in dev mode'} }} on {{os()}} / {{arch()}}"
6466
@echo "PWD $(pwd)"
6567
{{just_executable()}} --version
6668
rustc --version
@@ -84,7 +86,7 @@ fmt:
8486

8587
# Reformat all Cargo.toml files using cargo-sort
8688
fmt-toml *args: (cargo-install 'cargo-sort')
87-
cargo sort --workspace --grouped {{args}}
89+
cargo sort {{packages}} --grouped {{args}}
8890

8991
# Get any package's field from the metadata
9092
get-crate-field field package=main_crate: (assert-cmd 'jq')
@@ -95,20 +97,20 @@ get-msrv package=main_crate: (get-crate-field 'rust_version' package)
9597

9698
# Find the minimum supported Rust version (MSRV) using cargo-msrv extension, and update Cargo.toml
9799
msrv: (cargo-install 'cargo-msrv')
98-
cargo msrv find --write-msrv --ignore-lockfile {{features_flag}}
100+
cargo msrv find --write-msrv --ignore-lockfile {{features}}
99101

100102
# Run cargo-release
101103
release *args='': (cargo-install 'release-plz')
102104
release-plz {{args}}
103105

104106
# Check semver compatibility with prior published version. Install it with `cargo install cargo-semver-checks`
105107
semver *args: (cargo-install 'cargo-semver-checks')
106-
cargo semver-checks {{features_flag}} {{args}}
108+
cargo semver-checks {{features}} {{args}}
107109

108110
# Run all tests
109111
test:
110-
cargo test --workspace --all-targets {{features_flag}}
111-
cargo test --workspace --doc {{features_flag}}
112+
cargo test {{packages}} {{features}} {{targets}}
113+
cargo test --doc {{packages}} {{features}}
112114

113115
# Test documentation generation
114116
test-doc: (docs '')
@@ -119,7 +121,7 @@ test-fmt: && (fmt-toml '--check' '--check-format')
119121

120122
# Find unused dependencies. Install it with `cargo install cargo-udeps`
121123
udeps: (cargo-install 'cargo-udeps')
122-
cargo +nightly udeps --workspace --all-targets {{features_flag}}
124+
cargo +nightly udeps {{packages}} {{features}} {{targets}}
123125

124126
# Update all dependencies, including breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
125127
update:

0 commit comments

Comments
 (0)