SHELL=/bin/bash
.DEFAULT_GOAL=_help
LAKE ?= ~/.elan/bin/lake
.PHONY: cache
cache:
$(LAKE) exe cache get
LINT_LOCS_LEAN = $$(git ls-files '**/*.lean')
LINT_LOCS_PY = $$(git ls-files '*.py')
LINT_LOCS_SH = $$(git ls-files '*.sh')
.PHONY: format
format:
-prettier -w .
-pre-commit run --all-files
-black $(LINT_LOCS_PY)
-isort $(LINT_LOCS_PY)
-shfmt -w $(LINT_LOCS_SH)
cargo sort --workspace --grouped
.PHONY: clean
clean:
-$(LAKE) clean
-$(CARGO) clean
.PHONY: build
build:
$(CARGO) build --release --features cli
.PHONY: install
install:
$(CARGO) install --features cli --path .
.PHONY: lean
lean:
$(LAKE) build
@printf "\n$${STYLE_GREEN}--- Verification Complete ---$${STYLE_RESET}\n"
@printf "$${STYLE_CYAN}Mapped Theorems & Definitions:$${STYLE_RESET}\n"
@grep -E '^(theorem|def|class|instance|structure) ' RumaLean/*.lean RumaLean.lean || true
@printf "$${STYLE_GREEN}--------------------------------$${STYLE_RESET}\n"
.PHONY: docs
docs:
DOCGEN_SKIP_LEAN=1 DOCGEN_SKIP_STD=1 DOCGEN_SKIP_LAKE=1 DOCGEN_SKIP_DEPS=1 $(LAKE) build RumaLean:docs
CARGO ?= cargo
.PHONY: coverage
coverage:
@echo "Running focused code coverage for ruma-lean (std and no_std)..."
$(CARGO) tarpaulin --out Html \
--output-dir ../.tmp/coverage-lean \
--packages ruma-lean \
--ignore-panics \
--ignore-tests \
--skip-clean
@echo "Coverage report updated in ../.tmp/coverage-lean/tarpaulin-report.html"
.PHONY: lint
lint:
$(CARGO) clippy --all-targets --all-features -- -D warnings
$(LAKE) build
.PHONY: test
test:
$(CARGO) test --all-targets --all-features
.PHONY: e2e
e2e:
for f in res/*.json; do \
$(CARGO) run --release --features cli -- -i "$$f"; \
done
.PHONY: publish
publish:
@echo "Previewing packaged files..."
@echo "-----------------------------------"
$(CARGO) package --list
@echo ""
@echo "Simulating publish (--dry-run)"
@echo "-----------------------------------"
$(CARGO) publish --dry-run
.PHONY: fixtures
fixtures:
@mkdir -p res
python3 scripts/generate_benchmark_1k.py
@if [ -f .env ]; then set -a && source .env; fi; \
if [ -n "$$MATRIX_TOKEN" ]; then \
echo "Attempting to fetch live matrix state..."; \
python3 scripts/fetch_matrix_state.py || echo "Warning: Fetch failed, continuing..."; \
else \
echo "No MATRIX_TOKEN found, skipping live fetch."; \
fi
STYLE_CYAN := $(shell tput setaf 6 2>/dev/null || echo '\033[36m')
STYLE_GREEN := $(shell tput setaf 2 2>/dev/null || echo '\033[32m')
STYLE_RESET := $(shell tput sgr0 2>/dev/null || echo '\033[0m')
export STYLE_CYAN STYLE_GREEN STYLE_RESET
.PHONY: _help
_help:
@grep -hE '^[a-zA-Z0-9_\/-]+:[[:space:]]*##H .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":[[:space:]]*##H "}; {printf "$(STYLE_CYAN)%-15s$(STYLE_RESET) %s\n", $$1, $$2}'