aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: 8176780e7f251e400c13f9627345c46a2ee30dcb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PHONY: check clippy check-lock test-crate test-sync test-async expand fmt-expand lock

# make check
check: clippy expand fmt-expand test-crate test-sync test-async check-lock

# make lock
lock:
	for f in doc/usage/*_expand.rs; do \
		cp "$$f" "$$f.lock"; \
	done

# DO NOT RUN THEM

clippy:
	cargo clippy -- -D warnings

test-crate:
	cargo test

test-sync:
	cargo test -p might_be_async_test_sync --manifest-path test/Cargo.toml

test-async:
	cargo test -p might_be_async_test_async --features metadata_async --manifest-path test/Cargo.toml

expand:
	python3 scripts/expand_codes.py

fmt-expand:
	for f in doc/usage/*_expand.rs; do \
		case "$$f" in *.lock) ;; *) rustfmt "$$f" --edition 2024 --config blank_lines_lower_bound=0 ;; esac; \
	done

check-lock:
	errors=0; \
	for lock in doc/usage/*_expand.rs.lock; do \
		[ -f "$$lock" ] || continue; \
		base="$${lock%.lock}"; \
		if [ ! -f "$$base" ]; then \
			echo "ERROR: $$lock has no matching source file"; \
			errors=1; \
		elif git --no-pager diff --no-index --quiet "$$lock" "$$base" 2>/dev/null; then \
			:; \
		else \
			git --no-pager diff --no-index "$$lock" "$$base" || true; \
			echo "ERROR: $$base differs from $$lock"; \
			errors=1; \
		fi; \
	done; \
	exit $$errors