From 9973b79fa3a2cdf7c6a9decb30cf9eaed86c3da7 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Mon, 26 Oct 2026 04:31:55 +0100 Subject: [PATCH] make guards: fail if cargo tree fails --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 2f32fc76..2de10ab9 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,8 @@ check-dockerfile-manifests: CARGO_TREE_NAMES := cargo tree -p server -p worker -e normal --prefix none check-federation-off-deps: - @hits=$$($(CARGO_TREE_NAMES) --no-default-features | grep -E '^(k-ap|activitypub_federation|activitypub|sqlite-federation) ' | sort -u); \ + @tree=$$($(CARGO_TREE_NAMES) --no-default-features) || exit 1; \ + hits=$$(echo "$$tree" | grep -E '^(k-ap|activitypub_federation|activitypub|sqlite-federation) ' | sort -u); \ if [ -n "$$hits" ]; then \ echo "❌ federation-only crates in the --no-default-features server/worker tree:"; \ echo "$$hits"; \ @@ -115,12 +116,14 @@ check-federation-off-deps: echo "✅ federation-off tree has no k-ap, activitypub_federation, activitypub, or sqlite-federation" check-nats-isolated: - @if $(CARGO_TREE_NAMES) | grep -qE '^(async-nats|nats) '; then \ + @tree=$$($(CARGO_TREE_NAMES)) || exit 1; \ + nats_tree=$$($(CARGO_TREE_NAMES) --features nats) || exit 1; \ + if echo "$$tree" | grep -qE '^(async-nats|nats) '; then \ echo "❌ nats crates in the default server/worker tree:"; \ - $(CARGO_TREE_NAMES) | grep -E '^(async-nats|nats) ' | sort -u; \ + echo "$$tree" | grep -E '^(async-nats|nats) ' | sort -u; \ exit 1; \ fi; \ - if ! $(CARGO_TREE_NAMES) --features nats | grep -qE '^async-nats '; then \ + if ! echo "$$nats_tree" | grep -qE '^async-nats '; then \ echo "❌ async-nats missing from the --features nats server/worker tree — feature is not wired"; \ exit 1; \ fi; \ @@ -128,7 +131,8 @@ check-nats-isolated: check-no-second-web-stack: @for f in "" "--features nats"; do \ - hits=$$($(CARGO_TREE_NAMES) $$f | grep -E '^(actix|aws-lc)' | sort -u); \ + tree=$$($(CARGO_TREE_NAMES) $$f) || exit 1; \ + hits=$$(echo "$$tree" | grep -E '^(actix|aws-lc)' | sort -u); \ if [ -n "$$hits" ]; then \ echo "❌ actix/aws-lc crates in the server/worker tree ($${f:-default}):"; \ echo "$$hits"; \