F1: Project skeleton and pinned engine
Add the Godot 4.7.2 project, src/ module layout, LFS rules, licences, CLAUDE.md and the devlog. tools/godot.sh runs the repo-local engine, headless by default, and keeps engine data inside the repo. The engine version and SHA-512 sums are recorded in tools/. make check verifies the engine, checks binaries and parses every script. Closes #1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fails if a tracked binary file over 1 MB is stored in plain git instead of LFS.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
||||
|
||||
limit=$((1024 * 1024))
|
||||
status=0
|
||||
while IFS= read -r -d '' path; do
|
||||
[[ -f "$path" ]] || continue
|
||||
size="$(stat -c %s "$path")"
|
||||
((size > limit)) || continue
|
||||
# grep -I treats a file containing NUL bytes as non-matching, so text matches.
|
||||
if grep -Iq . "$path"; then
|
||||
continue
|
||||
fi
|
||||
filter="$(git check-attr filter -- "$path" | awk '{print $NF}')"
|
||||
if [[ "$filter" != "lfs" ]]; then
|
||||
echo "Binary over 1 MB is not in LFS: $path ($size bytes)" >&2
|
||||
status=1
|
||||
fi
|
||||
done < <(git ls-files -z)
|
||||
exit "$status"
|
||||
@@ -0,0 +1,2 @@
|
||||
ac9f3af3d8b62237694bc03e7422b8f7b1a39095cf4eeaa8361b7465f13bc9dbaad47f60ac0ac217c9f0b2b3712be207039cd83953f4c72087214bd0357cabbc tools/godot/Godot_v4.7.2-stable_linux.x86_64
|
||||
ca4d71c4d7b81dfc15d1a98baa07534aa95b03fdda78a0075b06672e1648d2e5f40980c9adc28d23e1b92e732ee7bf3461997aa804af74ec2fcd7a93ccb84079 tools/godot/Godot_v4.7.2-stable_export_templates.tpz
|
||||
@@ -0,0 +1,2 @@
|
||||
ca4d71c4d7b81dfc15d1a98baa07534aa95b03fdda78a0075b06672e1648d2e5f40980c9adc28d23e1b92e732ee7bf3461997aa804af74ec2fcd7a93ccb84079 Godot_v4.7.2-stable_export_templates.tpz
|
||||
9aa00f7a605200940bce3027a567b782f49bd8e940dd06ae9e987bd65aee1b1467edd56ed84fcdcbdd44354bf613bdbb4e5d2913e925850368e150c59ed54c65 Godot_v4.7.2-stable_linux.x86_64.zip
|
||||
@@ -0,0 +1 @@
|
||||
4.7.2.stable.official.ed1daf0bf
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/usr/bin/env bash
|
||||
# Runs the repo-local Godot engine pinned in tools/engine.version.
|
||||
#
|
||||
# tools/godot.sh [godot args...] run the engine, headless unless told otherwise
|
||||
# tools/godot.sh --verify check the engine's version and SHA-512, then exit
|
||||
#
|
||||
# Windows must never open on the host desktop, so --headless is added by default.
|
||||
# The offscreen container harness sets TIDEWALL_GODOT_DISPLAY=1, inside its container
|
||||
# only, to allow rendering to its private X server.
|
||||
#
|
||||
# User data, editor settings and caches are kept in .godot-home/ inside the repo.
|
||||
set -euo pipefail
|
||||
|
||||
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
binary="$repo/tools/godot/Godot_v4.7.2-stable_linux.x86_64"
|
||||
|
||||
if [[ ! -x "$binary" ]]; then
|
||||
cat >&2 <<MSG
|
||||
tools/godot.sh: the Godot engine is missing.
|
||||
Expected an executable at: $binary
|
||||
|
||||
tools/godot/ is git-ignored. Download Godot 4.7.2 (Linux x86_64 editor and export
|
||||
templates) from the official release, check them against tools/engine.upstream.sha512,
|
||||
and extract them there.
|
||||
MSG
|
||||
exit 127
|
||||
fi
|
||||
|
||||
verify() {
|
||||
local expected actual
|
||||
expected="$(cat "$repo/tools/engine.version")"
|
||||
actual="$("$binary" --headless --version | tail -n 1)"
|
||||
if [[ "$actual" != "$expected" ]]; then
|
||||
echo "tools/godot.sh: engine version is '$actual', expected '$expected'." >&2
|
||||
return 1
|
||||
fi
|
||||
# Only the binary: hashing the 1.2 GB templates on every check is wasteful.
|
||||
# R2 verifies the templates before packaging.
|
||||
(cd "$repo" && grep 'linux\.x86_64$' tools/engine.sha512 | sha512sum --check --quiet) || {
|
||||
echo "tools/godot.sh: engine binary does not match tools/engine.sha512." >&2
|
||||
return 1
|
||||
}
|
||||
echo "Engine OK: $actual"
|
||||
}
|
||||
|
||||
if [[ "${1:-}" == "--verify" ]]; then
|
||||
verify
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Keep the engine's data out of the user's home directory.
|
||||
export XDG_DATA_HOME="$repo/.godot-home/data"
|
||||
export XDG_CONFIG_HOME="$repo/.godot-home/config"
|
||||
export XDG_CACHE_HOME="$repo/.godot-home/cache"
|
||||
mkdir -p "$XDG_DATA_HOME" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME"
|
||||
touch "$repo/tools/godot/.gdignore"
|
||||
|
||||
args=("--path" "$repo")
|
||||
if [[ "${TIDEWALL_GODOT_DISPLAY:-0}" != "1" ]]; then
|
||||
args+=("--headless")
|
||||
fi
|
||||
|
||||
exec "$binary" "${args[@]}" "$@"
|
||||
@@ -0,0 +1,29 @@
|
||||
## Compiles every project script and exits non-zero if any fails.
|
||||
## Run with: tools/godot.sh --script res://tools/parse_all.gd
|
||||
extends SceneTree
|
||||
|
||||
const SKIP_DIRS: Array[String] = ["res://tools/godot", "res://test/fixtures"]
|
||||
|
||||
|
||||
func _initialize() -> void:
|
||||
var paths: Array[String] = []
|
||||
_collect("res://", paths)
|
||||
var failed: int = 0
|
||||
for path: String in paths:
|
||||
var script: GDScript = load(path) as GDScript
|
||||
if script == null or not script.can_instantiate():
|
||||
printerr("PARSE FAIL: %s" % path)
|
||||
failed += 1
|
||||
print("Parsed %d scripts, %d failed." % [paths.size(), failed])
|
||||
quit(1 if failed > 0 or paths.is_empty() else 0)
|
||||
|
||||
|
||||
func _collect(dir_path: String, out: Array[String]) -> void:
|
||||
if dir_path.trim_suffix("/") in SKIP_DIRS:
|
||||
return
|
||||
for name: String in DirAccess.get_files_at(dir_path):
|
||||
if name.ends_with(".gd"):
|
||||
out.append(dir_path.path_join(name))
|
||||
for name: String in DirAccess.get_directories_at(dir_path):
|
||||
if not name.begins_with("."):
|
||||
_collect(dir_path.path_join(name), out)
|
||||
Reference in New Issue
Block a user