- first_run.bat(纯 ASCII / CRLF):GODOT_EXE 顶部可覆写;where godot + 5 条便携路径探测;四步 headless(import / schema-validate / 单测 8 用例 / sim 门);任一步失败不中断,末尾汇总表 + logs\first_run.log 合并日志;双击运行自动 pause;已用 stub godot 实测三条路径(全 PASS / 全 FAIL / not found) - README.md:顶部 Quick start(首跑)3 行指向 first_run.bat 与首跑指南;.gitignore 增加 logs/
133 lines
5.5 KiB
Batchfile
133 lines
5.5 KiB
Batchfile
@echo off
|
|
rem ============================================================================
|
|
rem first_run.bat - WRATH OF THE DEAD (project F) one-click headless check
|
|
rem
|
|
rem Pure ASCII by design: non-ASCII bytes inside .bat files get mangled by
|
|
rem this machine's console code page. User-facing text stays English here;
|
|
rem the Chinese first-run guide lives at:
|
|
rem docs/engineering/2026-10-20-f-first-run-guide.md (workspace docs folder)
|
|
rem
|
|
rem Runs the same four headless checks as .github/workflows/ci.yml:
|
|
rem step 1 import --headless --path . --import
|
|
rem step 2 schema-validate -s res://src/tools/import_main.gd -- --validate-only
|
|
rem step 3 unit-tests -s res://tests/unit/test_runner.gd
|
|
rem step 4 sim-gates -s res://src/core/sim/sim_main.gd
|
|
rem Combined log: logs\first_run.log. Exit code 0 only if all four steps pass.
|
|
rem ============================================================================
|
|
|
|
setlocal EnableExtensions
|
|
chcp 65001 >nul
|
|
title WRATH OF THE DEAD - first run
|
|
cd /d "%~dp0"
|
|
|
|
rem --- User override: hardcode your Godot path here (empty = auto-detect) -----
|
|
set "GODOT_EXE="
|
|
|
|
set "LOG=%CD%\logs\first_run.log"
|
|
if not exist "logs\" mkdir "logs"
|
|
if exist "%LOG%" del /q "%LOG%"
|
|
|
|
rem --- 1. Locate Godot ---------------------------------------------------------
|
|
if defined GODOT_EXE (
|
|
if exist "%GODOT_EXE%" (
|
|
set "GODOT=%GODOT_EXE%"
|
|
) else (
|
|
echo GODOT_EXE is set but the file does not exist: %GODOT_EXE%
|
|
exit /b 1
|
|
)
|
|
)
|
|
if not defined GODOT for /f "delims=" %%i in ('where godot 2^>nul') do if not defined GODOT set "GODOT=%%~i"
|
|
if not defined GODOT for %%i in ("%USERPROFILE%\Desktop\Godot*.exe") do set "GODOT=%%~i"
|
|
if not defined GODOT for %%i in ("D:\Godot\Godot*.exe") do set "GODOT=%%~i"
|
|
if not defined GODOT for %%i in ("%LOCALAPPDATA%\Programs\Godot\Godot*.exe") do set "GODOT=%%~i"
|
|
if not defined GODOT for %%i in ("%LOCALAPPDATA%\Microsoft\WinGet\Packages\GodotEngine.GodotEngine*\Godot.exe") do set "GODOT=%%~i"
|
|
|
|
if not defined GODOT (
|
|
echo Godot not found. Extract Godot 4.7.x zip anywhere and either add to PATH or edit GODOT_EXE at top of this file
|
|
echo Recommended portable layout: D:\Godot\Godot.exe - this script probes that path by default
|
|
exit /b 1
|
|
)
|
|
echo Using Godot: "%GODOT%"
|
|
echo Project root: %CD%
|
|
echo.
|
|
|
|
> "%LOG%" echo ===== first_run started %DATE% %TIME% =====
|
|
|
|
rem --- 2. Four headless steps ---------------------------------------------------
|
|
> "logs\_step1.out" echo ===== step 1: import =====
|
|
echo ===== step 1: import =====
|
|
call "%GODOT%" --headless --path . --import >> "logs\_step1.out" 2>&1
|
|
set "RC1=%ERRORLEVEL%"
|
|
echo ===== step 1: import - exit code %RC1% =====
|
|
type "logs\_step1.out" >> "%LOG%"
|
|
>> "%LOG%" echo ===== step 1: import - exit code %RC1% =====
|
|
type "logs\_step1.out"
|
|
echo.
|
|
|
|
> "logs\_step2.out" echo ===== step 2: schema-validate =====
|
|
echo ===== step 2: schema-validate =====
|
|
call "%GODOT%" --headless --path . -s res://src/tools/import_main.gd -- --validate-only >> "logs\_step2.out" 2>&1
|
|
set "RC2=%ERRORLEVEL%"
|
|
echo ===== step 2: schema-validate - exit code %RC2% =====
|
|
type "logs\_step2.out" >> "%LOG%"
|
|
>> "%LOG%" echo ===== step 2: schema-validate - exit code %RC2% =====
|
|
type "logs\_step2.out"
|
|
echo.
|
|
|
|
> "logs\_step3.out" echo ===== step 3: unit-tests =====
|
|
echo ===== step 3: unit-tests =====
|
|
call "%GODOT%" --headless --path . -s res://tests/unit/test_runner.gd >> "logs\_step3.out" 2>&1
|
|
set "RC3=%ERRORLEVEL%"
|
|
echo ===== step 3: unit-tests - exit code %RC3% =====
|
|
type "logs\_step3.out" >> "%LOG%"
|
|
>> "%LOG%" echo ===== step 3: unit-tests - exit code %RC3% =====
|
|
type "logs\_step3.out"
|
|
echo.
|
|
|
|
> "logs\_step4.out" echo ===== step 4: sim-gates =====
|
|
echo ===== step 4: sim-gates =====
|
|
call "%GODOT%" --headless --path . -s res://src/core/sim/sim_main.gd >> "logs\_step4.out" 2>&1
|
|
set "RC4=%ERRORLEVEL%"
|
|
echo ===== step 4: sim-gates - exit code %RC4% =====
|
|
type "logs\_step4.out" >> "%LOG%"
|
|
>> "%LOG%" echo ===== step 4: sim-gates - exit code %RC4% =====
|
|
type "logs\_step4.out"
|
|
echo.
|
|
|
|
rem --- 3. Summary ---------------------------------------------------------------
|
|
echo ===== first_run summary =====
|
|
>> "%LOG%" echo ===== first_run summary =====
|
|
if "%RC1%"=="0" (set "R1=PASS") else (set "R1=FAIL")
|
|
if "%RC2%"=="0" (set "R2=PASS") else (set "R2=FAIL")
|
|
if "%RC3%"=="0" (set "R3=PASS") else (set "R3=FAIL")
|
|
if "%RC4%"=="0" (set "R4=PASS") else (set "R4=FAIL")
|
|
echo step 1 import exit %RC1% %R1%
|
|
echo step 2 schema-validate exit %RC2% %R2%
|
|
echo step 3 unit-tests exit %RC3% %R3%
|
|
echo step 4 sim-gates exit %RC4% %R4%
|
|
>> "%LOG%" echo step 1 import exit %RC1% %R1%
|
|
>> "%LOG%" echo step 2 schema-validate exit %RC2% %R2%
|
|
>> "%LOG%" echo step 3 unit-tests exit %RC3% %R3%
|
|
>> "%LOG%" echo step 4 sim-gates exit %RC4% %R4%
|
|
set "ALL=1"
|
|
if not "%RC1%"=="0" set "ALL=0"
|
|
if not "%RC2%"=="0" set "ALL=0"
|
|
if not "%RC3%"=="0" set "ALL=0"
|
|
if not "%RC4%"=="0" set "ALL=0"
|
|
if "%ALL%"=="1" goto :allpass
|
|
echo Some checks FAILED. Open logs\first_run.log and send the full error text back to engineering - do not fix code yourself.
|
|
goto :endlog
|
|
|
|
:allpass
|
|
echo All headless checks passed. Now run: godot --path . (or open project in editor and press F5) to play the graybox build. Debug keys: F5 next hall gate, F6 boss challenge, F1-F4 force events, F9 hotkey list.
|
|
|
|
:endlog
|
|
del /q "logs\_step*.out" 2>nul
|
|
echo Log: %CD%\logs\first_run.log
|
|
|
|
rem Keep the window open when launched by double-click (cmdcmdline then has /c).
|
|
echo.%cmdcmdline%| find /i "/c " >nul && pause
|
|
|
|
if "%ALL%"=="0" exit /b 1
|
|
exit /b 0
|