Skip to content

Commit d48ebdd

Browse files
committed
Small refinements to the justfile
- Rename `get-metadata` to the more accurate name `query-meta`. Since it is being used to do more processing than just dumping values as they literally appear in the JSON metadata. - Catch if `cargo metadata ...` fails and don't even run `jq`. This shouldn't increase memory requirements much, since `jq` without `--stream` always reads its full input anyway. (A middle ground could be to use `set -o pipefail`, but while that has recently been added to POSIX, `sh` is `dash` on Debian and Ubuntu, and `dash` doesn't yet support `-o pipefail`.) - Simplify `dbg` recipe to have `query-meta` concatenate `/debug`.
1 parent 404b6f4 commit d48ebdd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

justfile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,13 @@ unit-tests-flaky:
186186

187187
# Extract cargo metadata, excluding dependencies, and query it
188188
[private]
189-
get-metadata jq-query:
190-
cargo metadata --format-version 1 --no-deps | \
191-
jq --exit-status --raw-output -- {{ quote(jq-query) }}
189+
query-meta jq-query:
190+
meta="$(cargo metadata --format-version 1 --no-deps)" && \
191+
printf '%s\n' "$meta" | jq --exit-status --raw-output -- {{ quote(jq-query) }}
192192

193193
# Get the path to the directory where debug binaries are created during builds
194194
[private]
195-
dbg:
196-
target_dir="$({{ j }} get-metadata .target_directory)" && echo "$target_dir/debug"
195+
dbg: (query-meta '.target_directory + "/debug"')
197196

198197
# Run journey tests (`max`)
199198
journey-tests:
@@ -242,7 +241,7 @@ check-size:
242241
etc/check-package-size.sh
243242

244243
# Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form
245-
msrv: (get-metadata '''
244+
msrv: (query-meta '''
246245
.packages[]
247246
| select(.name == "gix")
248247
| .rust_version

0 commit comments

Comments
 (0)