diff --git a/.gitignore b/.gitignore index bc32a5f60..977564a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,12 @@ # Build and cache .cache/ +# Godot +client/.godot/ +client/export/ +client/reports/ +client/*.import + # Database journal files (transient, not the DB itself) db/commonwealth.db-wal db/commonwealth.db-shm diff --git a/Makefile b/Makefile index dceb5bfab..c0aa81dbf 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +GODOT := $(shell command -v godot4 2>/dev/null || command -v godot 2>/dev/null) + .PHONY: help setup build client server test lint ci ci-client ci-server clean \ decisions-sync decisions-coverage decisions-active decisions-orphan @@ -47,8 +49,8 @@ build-server: cd server && cargo build build-client: - @echo "Client build: Godot exports are configured via the editor." - @echo "Use 'make client' to run the client directly." + @test -n "$(GODOT)" || { echo "Godot not found. Run 'make setup' first."; exit 1; } + $(GODOT) --headless --path client --quit # --- Run --- @@ -56,13 +58,8 @@ server: cd server && cargo run client: - @if command -v godot4 >/dev/null 2>&1; then \ - godot4 --path client; \ - elif command -v godot >/dev/null 2>&1; then \ - godot --path client; \ - else \ - echo "Godot not found. Run 'make setup' first."; exit 1; \ - fi + @test -n "$(GODOT)" || { echo "Godot not found. Run 'make setup' first."; exit 1; } + $(GODOT) --path client # --- Test --- @@ -72,8 +69,8 @@ test-server: cd server && cargo test test-client: - @echo "Client tests run via gdUnit4 inside Godot." - @echo "TODO: headless test runner integration" + @test -n "$(GODOT)" || { echo "Godot not found. Run 'make setup' first."; exit 1; } + $(GODOT) --headless --path client -s res://addons/gdUnit4/bin/GdUnitCmdTool.gd --ignoreHeadlessMode -a res://tests/ # --- Lint --- @@ -84,7 +81,9 @@ lint-server: cd server && cargo fmt --check lint-client: - @echo "Client lint: TODO — gdlint / gdformat integration" + @test -n "$(GODOT)" || { echo "Godot not found. Run 'make setup' first."; exit 1; } + @echo "Checking GDScript for errors..." + @$(GODOT) --headless --path client --quit 2>&1 | grep -i "SCRIPT ERROR" && { echo "GDScript errors found"; exit 1; } || echo "No script errors found" # --- CI (run locally) --- @@ -113,4 +112,5 @@ decisions-orphan: clean: cd server && cargo clean || true rm -rf .cache/* + rm -rf client/.godot client/reports @echo "Clean complete."