elsmith 0.1.1

An Emacs Lisp language server with Lean-verified protocol and editing rules
Documentation
.PHONY: build check audit check-binary check-protocol check-editors corpus lexical-oracle scope-oracle bench-startup bench-slo

EMACS_LISP = $$(emacs -Q --batch --eval '(princ (expand-file-name "../lisp" data-directory))')

build:
	cargo build

ifndef ELSMITH_BINARY
ELSMITH_BINARY = target/debug/elsmith
check-binary: build
endif

check:
	nix fmt -- --ci
	cargo clippy --all-targets -- -D warnings
	lake -d lean build --wfail
	git diff --exit-code -- .leanfran lean
	@test -z "$$(git ls-files --others --exclude-standard -- .leanfran lean)"
	lisp="$(EMACS_LISP)" && test -d "$$lisp" && ELSMITH_EMACS_LISP="$$lisp" cargo test
	python3 tests/refactoring.py

audit:
	lake -d audit build --wfail

check-protocol: check-binary
	mkdir -p test-out
	rm -f test-out/strict.ndjson test-out/proxy.ndjson test-out/proxy-full.ndjson
	XDG_CACHE_HOME="$(CURDIR)/test-out/cache" "$(ELSMITH_BINARY)" catalog build-catalog > test-out/catalog.json
	XDG_CACHE_HOME="$(CURDIR)/test-out/cache" lsp-touchstone check check-server --record-file test-out/strict.ndjson --open-file tests/fixtures/sample.el --language-id emacs-lisp --server-command-args "$(ELSMITH_BINARY)" server run-server > test-out/strict.json
	python3 tests/protocol_proxy.py "$(ELSMITH_BINARY)"
	lsp-touchstone check check-record --target both --record-file test-out/proxy.ndjson > test-out/proxy.json
	lsp-touchstone check check-record --target both --record-file test-out/proxy-full.ndjson > test-out/proxy-full.json
	python3 tests/protocol_report.py test-out/strict.json test-out/proxy.json test-out/proxy-full.json

check-editors: check-binary
	python3 tests/editors.py --binary "$(ELSMITH_BINARY)"

corpus:
	lisp="$(EMACS_LISP)" && test -d "$$lisp" && ELSMITH_EMACS_LISP="$$lisp" cargo test --test corpus -- --nocapture

lexical-oracle:
	python3 tests/lexical_oracle.py tests/fixtures/lexical

scope-oracle:
	python3 tests/scope_oracle.py tests/fixtures/scope

bench-startup:
	cargo build --release
	python3 tests/startup_bench.py target/release/elsmith

bench-slo:
	cargo build --release
	python3 tests/slo_bench.py