History

Use `jq` to validate and format the `rust-version`

This is clearer than the inline shell script previously used, and also more robust.

Eliah Kagan committed 1 year ago

Commit efeb6e61 parent 654a8fa1 file · +10 −13Browse files

Unified · Split

justfile+10−13
@@ -242,19 +242,16 @@ check-size: · 241 unmodified lines
242 etc/check-package-size.sh242 etc/check-package-size.sh
243 243
244# Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form244# Report the Minimum Supported Rust Version (the `rust-version` of `gix`) in X.Y.Z form
245msrv:245msrv: (get-metadata '''
246 set -eu; \246 (.packages[] | select(.name == "gix") | .rust_version | tostring) as $v |
247 query='.packages[] | select(.name == "gix") | .rust_version'; \247 if ($v | test("^[0-9]+\\.[0-9]+\\.[0-9]+$")) then
248 value="$({{ j }} get-metadata "$query")"; \248 $v
249 case "$value" in \249 elif ($v | test("^[0-9]+\\.[0-9]+$")) then
250 *.*.*) \250 $v + ".0"
251 echo "$value" ;; \251 else
252 *.*) \252 error("Unrecognized rust-version format: " + $v)
253 echo "$value.0" ;; \253 end
254 *) \254''')
255 echo "No '.' in gix rust-version '$value'" >&2; \
256 exit 1 ;; \
257 esac
258 255
259# Regenerate the MSRV badge SVG256# Regenerate the MSRV badge SVG
260msrv-badge:257msrv-badge: