From c7d53a0e1a586c06c80d7e399dcf0a8eccd94aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Sun, 11 Dec 2022 23:05:50 +0100 Subject: [PATCH] Ingore dev and build dependencies in feature checking With cargo resolver 2, features enabled in build or dev dependencies are not merged anymore with the normal dependencies. So, for our script here we should also only enable normal dependencies. --- rust-features.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rust-features.sh b/rust-features.sh index fbd4ea8..8a7dc8f 100755 --- a/rust-features.sh +++ b/rust-features.sh @@ -46,7 +46,8 @@ function feature_does_not_imply() { echo "📏 Checking that $ENABLED does not imply $STAYS_DISABLED ..." # Check if the forbidden feature is enabled anywhere in the workspace. - if cargo tree --no-default-features --locked --workspace -e features --features "$ENABLED" | grep -qF "feature \"$STAYS_DISABLED\""; then + # But only check "normal" dependencies, so no "dev" or "build" dependencies. + if cargo tree --no-default-features --locked --workspace -e features,normal --features "$ENABLED" | grep -qF "feature \"$STAYS_DISABLED\""; then echo "❌ $ENABLED implies $STAYS_DISABLED in the workspace" else echo "✅ $ENABLED does not imply $STAYS_DISABLED in the workspace" @@ -61,7 +62,7 @@ function feature_does_not_imply() { echo "🔍 Checking all $NUM_CRATES crates - this takes some time." for CARGO in $CARGOS; do - OUTPUT=$(cargo tree --no-default-features --locked --offline -e features --features $ENABLED --manifest-path $CARGO 2>&1 || true) + OUTPUT=$(cargo tree --no-default-features --locked --offline -e features,normal --features $ENABLED --manifest-path $CARGO 2>&1 || true) if echo "$OUTPUT" | grep -qF "not supported for packages in this workspace"; then # This case just means that the pallet does not support the