Skip to content

Commit

Permalink
Add target to mithril common makefile that check its powerset of feat…
Browse files Browse the repository at this point in the history
…ures
  • Loading branch information
Alenar committed Jan 26, 2024
1 parent 507d8a4 commit 704d04e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion mithril-common/Makefile
@@ -1,6 +1,11 @@
.PHONY: all build test check debug run help doc
.PHONY: all build test check doc check-all-features-set

CARGO = cargo
# All the crates features excluding the two that have little to no impact to the code
FEATURES := $(shell ${CARGO} metadata --quiet --no-deps \
| jq -r '.packages[] | select(.name=="mithril-common") | .features \
| del(.allow_skip_signer_certification) | del(.portable) \
| keys | join(" ")')

all: test build

Expand All @@ -18,3 +23,16 @@ check:

doc:
${CARGO} doc --no-deps --open --features full

check-all-features-set:
# Compute the powerset of all the given features and save it to a temporary file
powerset() { [ $$# -eq 0 ] && echo || (shift; powerset "$$@") | while read r ; do echo "$$1 $$r"; echo "$$r"; done };\
powerset $$(echo "$(FEATURES)") > .features-sets

# Read the file to run cargo clippy on all those features sets
cat .features-sets | while read features_set; do \
echo "Clippy common with feature '$$features_set''"; \
${CARGO} clippy -p mithril-common --features "$$features_set"; \
done

rm .features-sets

0 comments on commit 704d04e

Please sign in to comment.