11#!/ usr/ bin/ env just --justfile
22
3- main_crate := ' sqlite-compressions'
4- features_flag := ' --all-features'
3+ main_crate := file_name (justfile_directory ())
54bin_name := snakecase (main_crate)
65sqlite3 := ' sqlite3'
76
7+ packages := ' --workspace' # All crates in the workspace
8+ features := ' --all-features' # Enable all features
9+ targets := ' --all-targets' # For all targets (lib, bin, tests, examples, benches)
10+
811# if running in CI, treat warnings as errors by setting RUSTFLAGS and RUSTDOCFLAGS to '-D warnings' unless they are already set
912# Use `CI=true just ci-test` to run the same tests as in GitHub CI.
1013# Use `just env-info` to see the current values of RUSTFLAGS and RUSTDOCFLAGS
@@ -37,15 +40,15 @@ build-ext *args:
3740
3841# Build the lib
3942build-lib :
40- cargo build --workspace
43+ cargo build {{ packages }}
4144
4245# Quick compile without building a binary
4346check :
44- cargo check --workspace --all-targets {{ features_flag }}
47+ cargo check {{ packages }} {{ features }} {{ targets }}
4548
4649# Quick compile - lib-only
4750check-lib :
48- cargo check --workspace
51+ cargo check {{ packages }}
4952
5053# Generate code coverage report to upload to codecov.io
5154ci-coverage : env-info && \
@@ -65,13 +68,13 @@ clean:
6568
6669# Run cargo clippy to lint the code
6770clippy * args :
68- cargo clippy --workspace --all-targets {{ features_flag }} {{ args}}
71+ cargo clippy {{ packages }} {{ features }} {{ targets }} {{ args}}
6972 cargo clippy --no-default-features --features default_loadable_extension {{ args}}
7073
7174# Generate code coverage report. Will install `cargo llvm-cov` if missing.
7275coverage * args = ' --no-clean --open': (cargo-install ' cargo-llvm-cov' )
7376 # do not enable --all-features here as it will cause sqlite runtime errors
74- cargo llvm-cov --workspace --all- targets --include-build-script {{ args}}
77+ cargo llvm-cov {{ packages }} {{ targets}} --include-build-script {{ args}}
7578 # TODO: add test coverage for the loadable extension too, and combine them
7679 # cargo llvm-cov --example {{bin_name}} --no-default-features --features default_loadable_extension --codecov --output-path codecov.info
7780
@@ -93,11 +96,11 @@ cross-test-ext-aarch64:
9396
9497# Build and open code documentation
9598docs * args = ' --open':
96- DOCS_RS=1 cargo doc --no-deps {{ args}} --workspace {{ features_flag }}
99+ DOCS_RS=1 cargo doc --no-deps {{ args}} {{ packages }} {{ features }}
97100
98101# Print environment info
99102env -info:
100- @ echo " Running {{ if ci_mode == ' 1' {' in CI mode' } else {' in dev mode' } }} on {{ os ()}} / {{ arch ()}} "
103+ @ echo " Running for ' {{ main_crate }} ' crate {{ if ci_mode == ' 1' {' in CI mode' } else {' in dev mode' } }} on {{ os ()}} / {{ arch ()}} "
101104 @ echo " PWD $(pwd)"
102105 {{ just_executable ()}} --version
103106 rustc --version
121124
122125# Reformat all Cargo.toml files using cargo-sort
123126fmt-toml * args : (cargo-install ' cargo-sort' )
124- cargo sort --workspace --grouped {{ args}}
127+ cargo sort {{ packages }} --grouped {{ args}}
125128
126129# Get any package's field from the metadata
127130get-crate-field field package = main_crate: (assert-cmd ' jq' )
@@ -140,7 +143,7 @@ release *args='': (cargo-install 'release-plz')
140143
141144# Check semver compatibility with prior published version. Install it with `cargo install cargo-semver-checks`
142145semver * args : (cargo-install ' cargo-semver-checks' )
143- cargo semver-checks {{ features_flag }} {{ args}}
146+ cargo semver-checks {{ features }} {{ args}}
144147
145148# Switch to the minimum rusqlite version
146149set-min-rusqlite-version :
@@ -174,7 +177,7 @@ test-fmt: && (fmt-toml '--check' '--check-format')
174177
175178# Find unused dependencies. Install it with `cargo install cargo-udeps`
176179udeps: (cargo-install ' cargo-udeps' )
177- cargo +nightly udeps --workspace --all-targets {{ features_flag }}
180+ cargo +nightly udeps {{ packages }} {{ features }} {{ targets }}
178181
179182# Update all dependencies, including breaking changes. Requires nightly toolchain (install with `rustup install nightly`)
180183update:
0 commit comments