-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck.sh
More file actions
executable file
·39 lines (32 loc) · 1.42 KB
/
Copy pathcheck.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.42 KB
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
#!/usr/bin/env bash
# Strict validation gate for the Input Forge addon (Godot 4.7).
#
# Godot's --check-only exit code is unreliable, so the authoritative signal is the
# printed "SCRIPT ERROR / Parse Error" text - we log-scan. With
# untyped_declaration=2 and the directory_rules gate on res://addons, untyped code
# prints a "Warning treated as error".
set -uo pipefail
GODOT="${GODOT:-$(command -v godot4 || command -v godot || true)}"
[[ -z "$GODOT" ]] && { echo "Godot not found. Install it or set \$GODOT." >&2; exit 1; }
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$ROOT"
LOG="$(mktemp)"
trap 'rm -f "$LOG"' EXIT INT TERM
# Optional crash-free lint (non-fatal; gdtoolkit can lag bleeding-edge syntax).
if command -v gdlint >/dev/null 2>&1; then
echo "-> gdformat --check / gdlint (optional, non-fatal)"
gdformat --check addons test 2>/dev/null || echo "gdformat differences"
gdlint addons test 2>/dev/null || echo "gdlint findings"
fi
echo "-> import"
"$GODOT" --headless --path . --import >>"$LOG" 2>&1 || true
echo "-> --check-only on every .gd"
while IFS= read -r -d '' f; do
echo "--- $f" >>"$LOG"
"$GODOT" --headless --path . --check-only --script "$f" >>"$LOG" 2>&1 || true
done < <(find addons test -name '*.gd' -print0)
if grep -nEi "SCRIPT ERROR|Parse Error|Failed to load script|Cannot open file|Compile Error" "$LOG"; then
echo "check.sh FAILED (see errors above)" >&2
exit 1
fi
echo "check.sh passed"