[pr-feature] Add one-click Build-Darner.cmd build and launch script #137
Loading…
Reference in a new issue
No description provided.
Delete branch "davetheshrew/Darner:pr/build-cmd"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
Build-Darner.cmdat the repository root (pure ASCII, CRLF line endings) for one-click building and launching on Windows:target\release\darner.exe(cargo build --release --locked -p darner, automatically adding%USERPROFILE%\.cargo\bintoPATHwhen present) and launchesgame_scarlett_master.exeviadarner.exe play.game_scarlett_master.exewithout hardcoded user paths by checkingDARNER_GAME_DIR,darner.toml(game_dir),game_dir.txt, besidedarner.exe,..\game, and..\Game, or prompting once (supporting drag-and-drop) and savinggame_dirto git-ignoreddarner.toml.build(release compile only),fast,diag(--features diagnostics), andcheck(Clippy, workspace tests, andcargo xtask policy).How it was tested
4d15827(onupstream/main57dea7f)Build-Darner.cmdis pure ASCII, 5,545 bytes, and uses CRLF line endings (219CRLF,0bare LF).git diff --stat upstream/main...HEAD: 1 file added (Build-Darner.cmd, 219 lines).TrustNo1/Darnerfor overlap withBuild-Darner.cmdor one-click.cmdbuild launchers.cargo build --release --locked -p darner, interactive execution on Windowscmd.exe, and the three Cargo CI gates +cargo xtask policymust still be run on Windows.Checklist
main.docs/asset-policy.md.Checked for overlap
work error SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON , says this in pr when i submit, why
Gemini 4 Hydrogen
Ran for 19s
Action history
That error means Forgejo's PR submit button made a background request expecting JSON, and git.gtahub.st (which sits behind Cloudflare + Caddy) returned an HTML page () instead. On git.gtahub.st that happens for one of three reasons:
Transient 502 Bad Gateway from Caddy/Cloudflare (git.gtahub.st threw intermittent 502s right before your message).
Expired browser session / CSRF token causing Forgejo to return an HTML login or error page instead of JSON.
Cloudflare WAF / bot challenge blocking the request (HTML comments like or CLI flags in the description occasionally trigger WAF rules on form posts).
Your first PR (#130, pr/build-optimise) is already open on TrustNo1/Darner, and pr/build-cmd is not created yet. Refresh the compare page, drop the comment line under ## Contributor role (optional), and retry — or reply "post it" if you want me to submit that exact pr/build-cmd PR directly via Forgejo's API.
darner.exe playto start, scripts as thin wrappers #167I tested
4d15827on Windows with stub Cargo and Darner executables and a synthetic title path containing a space. With a validgame_dir.txtas the only path source,Build-Darner.cmd fast < nulfell through to the prompt and returned 2. Passing that same path viaDARNER_GAME_DIRlaunched the stub asdarner.exe play <path>and returned 0.cmd.exeexpands%TXT_DIR%for the whole block beforeset /passigns it. I tested clearing that variable before the block and moving the call to:try_game_pathafter the block, guarded byif defined TXT_DIR. Thegame_dir.txtcase then passed the expected path and returned 0. No actual Cargo build or title run was needed for this check. Build-Darner.cmd, lines 118–122Review of
4d158271(read only, not built or run). Hold: one confirmed bug to fix first.What it does is right:
--release,--profile fast, and--profile diag --features diagnosticsall exist.darner.exe play <path to game_scarlett_master.exe>is a valid start, sinceplaytakes the exe as its first argument.checkmode runs the same gates as CI (clippy twice, tests,cargo xtask policy).darner.tomlis git-ignored, and the written[paths] game_dir = '...'matchesdarner.example.toml.f3840d73).Must fix:
game_dir.txtis never used (confirmed by tyr0nsur above). Inside theif exist "%~dp0game_dir.txt" ( ... )block,%TXT_DIR%is expanded when the whole block is parsed, beforeset /pfills it. So the call always gets an empty path, and the script falls through to the prompt. Movecall :try_game_path "%TXT_DIR%"out of the block, guarded byif defined TXT_DIR(and clearTXT_DIRbefore the block), as tyr0nsur tested.Should fix:
2.
game_dir.txtisn't git-ignored and isn't documented anywhere else. Either drop it as a source (DARNER_GAME_DIR,darner.tomland the prompt cover it), or add it to.gitignore.3. If a
darner.tomlalready exists withoutgame_dir, the prompt comes back on every launch and nothing is saved. Say so when that happens, or add the line.4. A path containing
'would make the written TOML invalid (a literal string can't hold one). It's rare; a check before writing is enough.5. Add one line about it to README's build section, and note that the default is the full release build (about 11 minutes) while
fasttakes 2 to 3.Before merge: run it once on Windows with a real
cargo buildand a game start, using each path source (env,darner.toml, the prompt), pluscheck.No testcall-ok yet: hold until item 1 is fixed. The script only builds in the clone and writes
darner.tomlthere, so after the fix it is safe to call for a test.I tested review items 3 and 4 on Windows 11 build 26300 with the unchanged
Build-Darner.cmdfrom4d15827129bb98988f66fb1879329485cec51b75. Cargo and Darner were argument-recording stubs, and the target was an empty fixture. Each second launch received an empty answer if prompted.O'Brien, fresh config: the first launch passed the exact path, exited 0 and printed “Saved game_dir”. Python 3.11tomllibrejected the resultingdarner.toml. The next launch prompted again, exited 2 and never called the Darner stub.game_dir: the first launch reached the stub and exited 0. The file stayed byte-for-byte identical, and the launcher gave no indication that the path would need to be entered again. The next launch prompted and exited 2.These six launcher invocations cover configuration persistence. The requested real build and game-start checks remain outstanding.
call :try_game_path "%TXT_DIR%"outside theif exist "%~dp0game_dir.txt"block (clearingTXT_DIRfirst and guarding withif defined TXT_DIR) sogame_dir.txtis expanded afterset /preads it./game_dir.txtto.gitignorebeside/darner.toml(also used byscripts/play-nvidia-framegen.ps1).darner.tomlalready exists without a validgame_direxplaining that it wasn't overwritten and showing the line to add (orDARNER_GAME_DIR).'inGAME_DIRbefore writingdarner.tomlso paths containing a single quote never produce invalid TOML.Build-Darner.cmdto the README build section noting the default release build (~11 minutes) vsfast(2 to 3 minutes).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.