WIP: build(tools): every build tool made from pinned sources and uploaded by the release, llvm in place of emsdk, offline builders #2295

Closed
HumanBean wants to merge 10 commits from HumanBean/Longshot:build/tools-cleanup into main
Owner

Summary

The builder now owns its build tools. Three installers (the Windows setup in C, builder/linux/linux_tools.py, and
the Launcher's own) and three environment builders had drifted apart. Now nx2/make_game.py's first stage, tools,
finds or installs tools.lock's tools on both systems with one Python implementation, scripts/tools_store.py, and sets
their variables itself. Nothing else installs them, so the Launcher, RecompLauncher and --cli get the same tools and
the same progress. On top of that, each tool is made from pinned sources and uploaded by the release.

Three of the Windows builder's build tools in tools.lock were still Hookshot v2.1.0's archives, and nobody could make
them again: python (3.14.7, numpy 2.5.3 where requirements.txt pins 2.5.4), cpm (an MSVC build of FFmpeg that needed
host/mingw_msvc_shims.c) and third-party (a stale a64emit.dll, stamp a0c19728 against the sources' f7a5a193,
so every player's PC built it again anyway; a 56 MB lld-link.exe the llvm-mingw build never uses; zbic; the SDL DLLs).
The Linux compiler was called emsdk although it is a plain LLVM 23.1.5. Developers' mise install pulled in tools only
CircleCI work or the website needs.

This PR:

  • Every tool is made from pinned sources and releases. scripts/windows/deps.sh (scripts/linux/docker.sh windows-tools) makes Windows' python (python-build-standalone 3.12.16, the same as the AppImage's, with
    requirements.txt's wheels), cpm (the Linux cpm's headers, dav1d, and FFmpeg 9.0.2 cross-built with llvm-mingw:
    lib*.a, VP8/VP9, w32threads) and sdl (libsdl's SDL3 3.4.20 and sdl2-compat 2.32.74 DLLs, the versions
    third_party/sdl2/VERSION.txt names). third-party is gone: a64emit, zbic and lld-link are already built from
    third_party on first use. Windows tools go from 120 MB to 67 MB zipped, plus llvm-mingw.

  • Each archive comes out the same twice (Windows' three built twice, llvm built from deps.sh and repacked: same
    SHA-256 each time). tools.py pack was already deterministic; nasm now runs with --reproducible for FFmpeg too.

  • The release uploads them, nobody's token. A pull request writes the line (tools.py add ... --no-upload). The
    release's version job lists lines whose copy the store lacks (tools.py missing); tools-make makes them again in
    Ubuntu 22.04 and tools-publish (deploy runner) checks each is the archive its line names (tools.py publish) and
    uploads it as the BeanTools account (a team with Packages: Write alone), whose write:package token is the
    sealed secret PACKAGES_TOKEN_SEALED: only the deploy runner's seal.key opens it, like the release key. The
    builders wait for both. tools.py assemble (which built on top of Hookshot's archives) is
    removed. The sysroot is the build system's files of the day, so a new one is still uploaded by hand.

  • emsdk is llvm (usr/lib/longshot/llvm, an LLVM release's layout bin/), named by LONGSHOT_LLVM
    (third_party/a64-kit/tools/toolchain.py llvm_bin). EMSDK still works for an emsdk checkout, and an older Longshot
    Launcher, which sets EMSDK=<lib>/emsdk, still builds a new version: the tools stage sets LONGSHOT_LLVM over it.
    dev.py base builds an older revision with that revision's own tools.lock (EMSDK, its SDL DLLs). Each Linux player
    downloads the 141 MB compiler once more after updating.

  • The tools stage (scripts/tools_store.py). A tool comes from the first of:

    1. the caller's variable, as an older Launcher sets it;
    2. the builder itself: carried at its dest with a stamp in <tools>/.tools/, or placed there by an older Launcher
      whose toolchain.json names it;
    3. a store shared by every version, <store>/<sha256>/, at LONGSHOT_TOOLS_STORE, else the builder's home;
    4. downloaded into the store, under a lock.

    It prints @@stage tools and @@progress, or progress lines with --prepare. make_game.py --tools-only runs only
    this stage, and --stamps prints the compiler and translator stamps the Launcher keys shader caches by.
    tools_store.py gc cleans the store, and builder.json marks a builder that owns its tools.

  • The rest gets smaller.

    • builder/setup/setup.c no longer downloads, unpacks or reuses parts: it copies and publishes the builder and
      starts it. WinHTTP and bcrypt are gone, and the --wine check now runs the builder's --cli --stamps.
    • AppRun --cli hands straight to make_game.py, and builder/linux/linux_tools.py is deleted.
    • Runner.cs and AppRun take the PC's own tool variables out, so a player's RX_CPM or LONGSHOT_MINGW never stands
      in for the builder's tools.
    • dev.py uses the same store (tools-store/ in the development folder, shared by every checkout).
    • SDL comes from LONGSHOT_SDL_DIR.
  • The Windows zip carries its Python at LongshotBuilder\tools\python, pinned in builder/windows/python.lock, so
    it is no longer a tools.lock line. An older Launcher never adds a second copy.

  • Offline builders. Each release also ships LongshotBuilder-<v>-windows-x64-offline.zip and
    Longshot-<v>-offline-x86_64.AppImage, with every tool unpacked at its dest and stamped. The tools stage takes them
    as they are, so nothing is downloaded on the player's PC. The Launcher side (installing a builder whose tools it
    owns, and importing an offline one) is a LongshotLauncher pull request, to follow.

  • mise: conftest and circleci-cli are opt in (mise.circleci.toml, MISE_ENV=circleci mise install), as only a
    change to .circleci/ needs them. Node moves to website/mise.toml, at 22.23.4: the old pin, 22.12.0, was below
    website/package.json's engines (>=22.23.4).

Read first: scripts/tools_store.py, nx2/make_game.py (build_tools, print_stamps), scripts/windows/deps.sh, .forgejo/workflows/release.yml (tools-make, tools-publish),
scripts/tools.py (missing, publish), third_party/a64-kit/tools/toolchain.py llvm_bin, builder/setup/setup.c
(work), scripts/builder_package.py (make_zip), nx2/build.py ffmpeg_windows_libs.

Testing

Tested: not in the game yet (opened with --force at the maintainer's request). On this PC (CachyOS, Linux):

  • scripts/tools_store.py env --install into an empty store installed all five Linux tools in 5 s; a second run
    downloaded nothing.
  • make_game.py --tools-only, --prepare --tools-only and --stamps all work, and dev.py env uses the shared store.
  • The offline AppImage carries all five tools stamped, and its own --tools-only with an empty store downloaded
    nothing.
  • setup.c compiles with llvm-mingw and no warnings. Also:
    scripts/linux/docker.sh windows-tools twice and ONLY=llvm scripts/linux/docker.sh tools, each archive the same
    SHA-256 every time; the archives' contents checked (numpy 2.5.4, no Tk, FFmpeg's lib*.a with _beginthreadex, the two
    SDL DLLs); the workflows parse. No checks run on this PC (the maintainer's rule): left to CI.

Still to test:

  • Linux, this PC: build the AppImage and the offline AppImage (scripts/linux/docker.sh), build and play with the offline
    one with the network off, expecting no download and the game as on main (by hand)
  • Windows, NVIDIA and AMD: a build with this branch's tools, expecting it to build, the intro's movies to play (FFmpeg
    VP9, dav1d AV1) and controllers to work (SDL) (@Beanstalk, once the archives are in the store)
  • Windows: the offline zip unpacked with the network off, expecting its setup to say "carried by this offline Builder" for
    each part and the build to finish (by hand)
  • Release: the first nightly after merge runs tools-make and tools-publish and uploads the four archives as
    BeanTools (set up: the account, its team and PACKAGES_TOKEN_SEALED, checked to open on the server)

Measurements

Nothing to measure in the game: the same LLVM, FFmpeg version and SDL DLLs, built from the same pins. Sizes instead:
Windows' tools without llvm-mingw 120.1 MB β†’ 67.2 MB zipped (python 56.0 β†’ 55.7, cpm 19.8 β†’ 10.2, third-party 26.6 β†’
sdl 1.3); llvm 141.5 MB, as emsdk. The offline files add about the tools' size to each release.

Risks

  • The first release after merge is the first upload as BeanTools: a token or registry refusal stops tools-publish,
    and no builder is built that night (the release run's log says why). The setup is done (releases.md, One-time setup).
  • Windows players' builds link a different FFmpeg build (llvm-mingw, same 9.0.2): a movie that decodes wrongly would show
    there. Revert is enough.
  • Linux players download the compiler again once (llvm replaces emsdk). An older launcher keeps working.
  • third_party/a64-kit/tools/toolchain.py changed by four lines: LONGSHOT_LLVM/bin when it is set, else emsdk's
    upstream/bin as before. Recorded in its PROVENANCE.md, tree hash updated.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (not yet: Still to test)
  • mise run test passes (any failure that also fails on main is named). (left to CI)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.
    (third_party/a64-kit/tools/toolchain.py's LLVM lookup, recorded in its PROVENANCE.md: accepted by the maintainer)

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: Still to test)
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

πŸ€– Generated with Claude Code

## Summary **The builder now owns its build tools.** Three installers (the Windows setup in C, `builder/linux/linux_tools.py`, and the Launcher's own) and three environment builders had drifted apart. Now `nx2/make_game.py`'s first stage, `tools`, finds or installs tools.lock's tools on both systems with one Python implementation, `scripts/tools_store.py`, and sets their variables itself. Nothing else installs them, so the Launcher, RecompLauncher and `--cli` get the same tools and the same progress. On top of that, each tool is made from pinned sources and uploaded by the release. Three of the Windows builder's build tools in `tools.lock` were still Hookshot v2.1.0's archives, and nobody could make them again: `python` (3.14.7, numpy 2.5.3 where `requirements.txt` pins 2.5.4), `cpm` (an MSVC build of FFmpeg that needed `host/mingw_msvc_shims.c`) and `third-party` (a stale `a64emit.dll`, stamp `a0c19728` against the sources' `f7a5a193`, so every player's PC built it again anyway; a 56 MB `lld-link.exe` the llvm-mingw build never uses; zbic; the SDL DLLs). The Linux compiler was called `emsdk` although it is a plain LLVM 23.1.5. Developers' `mise install` pulled in tools only CircleCI work or the website needs. This PR: - **Every tool is made from pinned sources and releases.** `scripts/windows/deps.sh` (`scripts/linux/docker.sh windows-tools`) makes Windows' `python` (python-build-standalone 3.12.16, the same as the AppImage's, with `requirements.txt`'s wheels), `cpm` (the Linux cpm's headers, dav1d, and FFmpeg 9.0.2 cross-built with llvm-mingw: `lib*.a`, VP8/VP9, `w32threads`) and `sdl` (libsdl's SDL3 3.4.20 and sdl2-compat 2.32.74 DLLs, the versions `third_party/sdl2/VERSION.txt` names). `third-party` is gone: a64emit, zbic and lld-link are already built from `third_party` on first use. Windows tools go from 120 MB to 67 MB zipped, plus llvm-mingw. - **Each archive comes out the same twice** (Windows' three built twice, llvm built from `deps.sh` and repacked: same SHA-256 each time). `tools.py pack` was already deterministic; nasm now runs with `--reproducible` for FFmpeg too. - **The release uploads them, nobody's token.** A pull request writes the line (`tools.py add ... --no-upload`). The release's version job lists lines whose copy the store lacks (`tools.py missing`); `tools-make` makes them again in Ubuntu 22.04 and `tools-publish` (deploy runner) checks each is the archive its line names (`tools.py publish`) and uploads it as the **BeanTools** account (a team with *Packages: Write* alone), whose `write:package` token is the sealed secret `PACKAGES_TOKEN_SEALED`: only the deploy runner's `seal.key` opens it, like the release key. The builders wait for both. `tools.py assemble` (which built on top of Hookshot's archives) is removed. The sysroot is the build system's files of the day, so a new one is still uploaded by hand. - **`emsdk` is `llvm`** (`usr/lib/longshot/llvm`, an LLVM release's layout `bin/`), named by `LONGSHOT_LLVM` (`third_party/a64-kit/tools/toolchain.py` `llvm_bin`). `EMSDK` still works for an emsdk checkout, and an older Longshot Launcher, which sets `EMSDK=<lib>/emsdk`, still builds a new version: the tools stage sets `LONGSHOT_LLVM` over it. `dev.py base` builds an older revision with that revision's own `tools.lock` (`EMSDK`, its SDL DLLs). Each Linux player downloads the 141 MB compiler once more after updating. - **The tools stage** (`scripts/tools_store.py`). A tool comes from the first of: 1. the caller's variable, as an older Launcher sets it; 2. the builder itself: carried at its dest with a stamp in `<tools>/.tools/`, or placed there by an older Launcher whose `toolchain.json` names it; 3. a store shared by every version, `<store>/<sha256>/`, at `LONGSHOT_TOOLS_STORE`, else the builder's home; 4. downloaded into the store, under a lock. It prints `@@stage tools` and `@@progress`, or `progress` lines with `--prepare`. `make_game.py --tools-only` runs only this stage, and `--stamps` prints the compiler and translator stamps the Launcher keys shader caches by. `tools_store.py gc` cleans the store, and `builder.json` marks a builder that owns its tools. - **The rest gets smaller.** - `builder/setup/setup.c` no longer downloads, unpacks or reuses parts: it copies and publishes the builder and starts it. WinHTTP and bcrypt are gone, and the `--wine` check now runs the builder's `--cli --stamps`. - `AppRun --cli` hands straight to `make_game.py`, and `builder/linux/linux_tools.py` is deleted. - `Runner.cs` and AppRun take the PC's own tool variables out, so a player's `RX_CPM` or `LONGSHOT_MINGW` never stands in for the builder's tools. - `dev.py` uses the same store (`tools-store/` in the development folder, shared by every checkout). - SDL comes from `LONGSHOT_SDL_DIR`. - **The Windows zip carries its Python** at `LongshotBuilder\tools\python`, pinned in `builder/windows/python.lock`, so it is no longer a `tools.lock` line. An older Launcher never adds a second copy. - **Offline builders.** Each release also ships `LongshotBuilder-<v>-windows-x64-offline.zip` and `Longshot-<v>-offline-x86_64.AppImage`, with every tool unpacked at its dest and stamped. The tools stage takes them as they are, so nothing is downloaded on the player's PC. The Launcher side (installing a builder whose tools it owns, and importing an offline one) is a LongshotLauncher pull request, to follow. - **mise:** conftest and circleci-cli are opt in (`mise.circleci.toml`, `MISE_ENV=circleci mise install`), as only a change to `.circleci/` needs them. Node moves to `website/mise.toml`, at 22.23.4: the old pin, 22.12.0, was below `website/package.json`'s `engines` (`>=22.23.4`). Read first: `scripts/tools_store.py`, `nx2/make_game.py` (`build_tools`, `print_stamps`), `scripts/windows/deps.sh`, `.forgejo/workflows/release.yml` (`tools-make`, `tools-publish`), `scripts/tools.py` (`missing`, `publish`), `third_party/a64-kit/tools/toolchain.py` `llvm_bin`, `builder/setup/setup.c` (`work`), `scripts/builder_package.py` (`make_zip`), `nx2/build.py` `ffmpeg_windows_libs`. ## Testing **Tested:** not in the game yet (opened with `--force` at the maintainer's request). On this PC (CachyOS, Linux): - `scripts/tools_store.py env --install` into an empty store installed all five Linux tools in 5 s; a second run downloaded nothing. - `make_game.py --tools-only`, `--prepare --tools-only` and `--stamps` all work, and `dev.py env` uses the shared store. - The offline AppImage carries all five tools stamped, and its own `--tools-only` with an empty store downloaded nothing. - `setup.c` compiles with llvm-mingw and no warnings. Also: `scripts/linux/docker.sh windows-tools` twice and `ONLY=llvm scripts/linux/docker.sh tools`, each archive the same SHA-256 every time; the archives' contents checked (numpy 2.5.4, no Tk, FFmpeg's `lib*.a` with `_beginthreadex`, the two SDL DLLs); the workflows parse. No checks run on this PC (the maintainer's rule): left to CI. **Still to test:** - Linux, this PC: build the AppImage and the offline AppImage (`scripts/linux/docker.sh`), build and play with the offline one with the network off, expecting no download and the game as on main (by hand) - Windows, NVIDIA and AMD: a build with this branch's tools, expecting it to build, the intro's movies to play (FFmpeg VP9, dav1d AV1) and controllers to work (SDL) (@Beanstalk, once the archives are in the store) - Windows: the offline zip unpacked with the network off, expecting its setup to say "carried by this offline Builder" for each part and the build to finish (by hand) - Release: the first nightly after merge runs `tools-make` and `tools-publish` and uploads the four archives as BeanTools (set up: the account, its team and `PACKAGES_TOKEN_SEALED`, checked to open on the server) ## Measurements Nothing to measure in the game: the same LLVM, FFmpeg version and SDL DLLs, built from the same pins. Sizes instead: Windows' tools without llvm-mingw 120.1 MB β†’ 67.2 MB zipped (python 56.0 β†’ 55.7, cpm 19.8 β†’ 10.2, third-party 26.6 β†’ sdl 1.3); llvm 141.5 MB, as emsdk. The offline files add about the tools' size to each release. ## Risks - The first release after merge is the first upload as BeanTools: a token or registry refusal stops `tools-publish`, and no builder is built that night (the release run's log says why). The setup is done (releases.md, One-time setup). - Windows players' builds link a different FFmpeg build (llvm-mingw, same 9.0.2): a movie that decodes wrongly would show there. Revert is enough. - Linux players download the compiler again once (`llvm` replaces `emsdk`). An older launcher keeps working. - `third_party/a64-kit/tools/toolchain.py` changed by four lines: `LONGSHOT_LLVM/bin` when it is set, else emsdk's `upstream/bin` as before. Recorded in its `PROVENANCE.md`, tree hash updated. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [ ] Tested on my own PC, in the game for a change the game runs, as Testing says. (not yet: Still to test) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (left to CI) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. (`third_party/a64-kit/tools/toolchain.py`'s LLVM lookup, recorded in its PROVENANCE.md: accepted by the maintainer) ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. (Windows: Still to test) - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
chore(third_party): a64-kit's PROVENANCE.md names Longshot's LONGSHOT_LLVM lookup, and its tree hash
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 11s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 14s
Website / Website on Cloudflare (pull_request_target) Has been skipped
Third-party parts / As their notes say (pull_request) Successful in 16s
CI / Website build and checks (pull_request) Successful in 3m12s
2285f6d259
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Built on this PC (CachyOS) with this head, in scripts/linux/docker.sh: Longshot-dev-x86_64.AppImage (104 MB) and Longshot-dev-offline-x86_64.AppImage (243 MB, every linux-x64 tool at its dest inside). Not yet played: the game run with the offline one, network off, is next (Still to test).

Built on this PC (CachyOS) with this head, in scripts/linux/docker.sh: Longshot-dev-x86_64.AppImage (104 MB) and Longshot-dev-offline-x86_64.AppImage (243 MB, every linux-x64 tool at its dest inside). Not yet played: the game run with the offline one, network off, is next (Still to test).
Member

Possibly related, for context:

  • issue #276 Idea: offline install option. β€” Open request for fully offline builder/install support
  • PR #447 fix(setup): a failed update gives the installed Builder its tools back β€” Overlaps setup tool reuse and offline bundled-tool handling
  • PR #113 build(linux): the Linux builder gets its build tools from tools.lock, as Windows does β€” Merged foundation for tools.lock-managed Linux tools; this updates/replaces its tool layout
Possibly related, for context: - issue #276 Idea: offline install option. β€” Open request for fully offline builder/install support - PR #447 fix(setup): a failed update gives the installed Builder its tools back β€” Overlaps setup tool reuse and offline bundled-tool handling - PR #113 build(linux): the Linux builder gets its build tools from tools.lock, as Windows does β€” Merged foundation for tools.lock-managed Linux tools; this updates/replaces its tool layout
Author
Owner

The Launcher's side: MagicBeanDev/LongshotLauncher#256 (LONGSHOT_LLVM for an llvm version, EMSDK for an older one; install from an offline builder, checked against the release's signed SHA256SUMS).

The Launcher's side: https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/256 (LONGSHOT_LLVM for an llvm version, EMSDK for an older one; install from an offline builder, checked against the release's signed SHA256SUMS).
refactor(builder): the build finds or installs its own tools (make_game.py's tools stage, scripts/tools_store.py); the setup, AppRun and dev.py install none; the Windows zip carries its Python
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 13s
PR description / Description follows the template (pull_request_target) Successful in 12s
CI / Website build and checks (pull_request) Successful in 6m52s
b4556fa07c
One installer for both systems in place of three: setup.c's downloader, builder/linux/linux_tools.py and
(for a Launcher that drives the builder) the Launcher's own. A shared store of tools by archive; carried tools
(an offline builder, the Windows Python) by their stamp; an older Launcher's by its toolchain.json.
make_game.py --tools-only and --stamps for front ends.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

Pushed the refactor: the build owns its tools (make_game.py's tools stage, scripts/tools_store.py), the setup and AppRun install none, linux_tools.py is gone, the Windows zip carries its Python (builder/windows/python.lock), offline builders carry their tools at their dests. Checked on this PC as Testing says; not yet in the game.

Pushed the refactor: the build owns its tools (make_game.py's tools stage, scripts/tools_store.py), the setup and AppRun install none, linux_tools.py is gone, the Windows zip carries its Python (builder/windows/python.lock), offline builders carry their tools at their dests. Checked on this PC as Testing says; not yet in the game.
fix(builder): an older Launcher's tools are found by its record's dest and folder name, as Core/ToolsLock.cs writes a part with a prefix
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 13s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Successful in 10m2s
7741e4930d
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Owner

The Launcher's side is now MagicBeanDev/LongshotLauncher#257 (replacing #256 there): it installs only a builder that owns its tools, runs make_game.py --tools-only with its store, keys shader caches by --stamps, and imports offline builders. Also pushed here: an older Launcher's tools are found by its record (its dest and folder name, as Core/ToolsLock.cs writes them), so a new release under an old Launcher downloads nothing again.

The Launcher's side is now https://git.magicbean.dev/MagicBeanDev/LongshotLauncher/pulls/257 (replacing #256 there): it installs only a builder that owns its tools, runs make_game.py --tools-only with its store, keys shader caches by --stamps, and imports offline builders. Also pushed here: an older Launcher's tools are found by its record (its dest and folder name, as Core/ToolsLock.cs writes them), so a new release under an old Launcher downloads nothing again.
Author
Owner
@review
BeanBot left a comment

Recommendation: Request changes. The offline Windows builder can ignore its carried tools when the same version was installed previously, and development builds of older revisions lose tools they expect. The changed build and release paths also still need the stated platform runs.

The change centralizes tool installation, rebuilds Windows dependencies from pinned sources, and adds offline builders. It reduces the stated Windows tool archive size from 120.1 MB to 67.2 MB, but introduces compatibility problems for existing installations and older development revisions.

Blocking (3): must change before merging.

  1. L1 builder/setup/setup.c:363: The offline zip reuses an existing installation of the same version without copying its carried tools. When: A player first starts the online zip, then takes the offline zip for that version to the same PC with an empty tool store and no network. The existing marker and healthy executable skip the copy, so the builder starts the online installation and attempts downloads instead of using the offline zip. Do: Detect and install or merge the offline package's stamped tools when the existing version lacks them, and test online-then-offline installation of the same version.
  2. L2 scripts/devtools/build.py:350: Building a base from an older Windows revision no longer puts SDL's DLLs where that revision reads them. (more on the line) Do: Stage the DLLs into older worktrees when their build code does not support LONGSHOT_SDL_DIR, and cover a base built from a revision before this change.
  3. L3 scripts/devtools/build.py:185: The environment supplied to an older Linux base no longer identifies its compiler to that revision. (more on the line) Do: Provide an EMSDK-compatible layout or other compatibility environment when building revisions whose toolchain only understands EMSDK, and test that path against the base revision.

Should fix (1): not blocking, but worth doing before merging.

  • L4 scripts/tools_store.py:208: Applying the installed Windows tools sets LONGSHOT_MINGW even when LONGSHOT_MSVC=1 requests the Visual Studio route. (more on the line) Do: Honor LONGSHOT_MSVC when applying the compiler environment, and add a test that checks the selected toolchain.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L5: The new Windows toolchain and offline package have not completed a player build and game run. When: The Windows release now links a newly built FFmpeg and supplies new SDL and Python packages; the reported checks inspect archives but do not show that a player's build, movies and controllers work. Do: Build and play with the released Windows tools, including VP9 and AV1 movies and controllers, and repeat with the offline zip disconnected on the stated Windows systems.
  • L6: The Linux offline builder has not completed a disconnected game build and play run. When: The reported AppImage test reaches the tools-only stage; it does not exercise the compiler, libraries and game produced from the carried tools. Do: Build and play using the offline AppImage with the network disconnected, including the affected supported Linux hardware.
  • L7 .forgejo/workflows/release.yml:267: The new release path has not demonstrated that its integration token can publish the missing archives. (more on the line) Do: Exercise a release-equivalent missing-tool upload with the configured Authorized Integration and verify both builder jobs proceed.

@fix can do L1, L2, L3 and L4.

Checks: Failing on this head, which is behind its base, where it passes: Guide screenshots / Guide images and local UI source review (pull_request). @rebase (or @fix) brings it up to date and runs it again; not held against it.

More: does it help, other systems, switches, what was read

Does it help: Unproven: the author reports archive sizes and successful tool-stage and packaging checks, but neither platform has completed a game build and play test with these tools. The release upload integration is also untested.

Other systems: Windows setup, older revisions built through dev.py, Linux AppImage builds, the Launcher, FFmpeg movie decoding, SDL controllers, and release publishing are affected. The supplied runs do not establish end-to-end behavior on Windows or a Linux offline game build.

Switches: LONGSHOT_LLVM selects an LLVM release directory; LONGSHOT_TOOLS_STORE selects the shared store; --tools-only runs tool preparation; --stamps prints cache stamps; OFFLINE defaults to 1 when producing AppImages. LONGSHOT_MSVC=1 is still documented as selecting MSVC, but the new tool stage overrides that selection in installed Windows builders.

Reviewed: 7741e4930d against 753fb5af68: Read the repository instructions, contribution rules, PR template and standards; commit history; tools_store.py, tools.py, AppRun, Runner.cs, Windows dependency script, toolchain.py, and relevant setup, packaging, release and build paths. Skimmed the remaining changed diffs, tests, documentation and workflow files; did not read every changed code file in full.; nothing run (a code review).

Checked and fine:

  • Every commit in the supplied range has an AI assistance trailer.
  • The Windows Python lock is included in the release's missing-tool and publish lookup.
  • The offline package stamps are checked against the corresponding tool hashes before use.

Testing: Read-only review; no builds, tests or project scripts were run. The author reports Linux tool-stage and AppImage packaging checks, but no completed game run.

Overlaps and merge order: LongshotLauncher#257 is the stated companion for builder-owned tools and offline imports; its merge order and compatibility need maintainer coordination.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Request changes.** The offline Windows builder can ignore its carried tools when the same version was installed previously, and development builds of older revisions lose tools they expect. The changed build and release paths also still need the stated platform runs. The change centralizes tool installation, rebuilds Windows dependencies from pinned sources, and adds offline builders. It reduces the stated Windows tool archive size from 120.1 MB to 67.2 MB, but introduces compatibility problems for existing installations and older development revisions. **Blocking (3)**: must change before merging. 1. **L1** `builder/setup/setup.c:363`: The offline zip reuses an existing installation of the same version without copying its carried tools. *When:* A player first starts the online zip, then takes the offline zip for that version to the same PC with an empty tool store and no network. The existing marker and healthy executable skip the copy, so the builder starts the online installation and attempts downloads instead of using the offline zip. **Do:** Detect and install or merge the offline package's stamped tools when the existing version lacks them, and test online-then-offline installation of the same version. 2. **L2** `scripts/devtools/build.py:350`: Building a base from an older Windows revision no longer puts SDL's DLLs where that revision reads them. (more on the line) **Do:** Stage the DLLs into older worktrees when their build code does not support LONGSHOT_SDL_DIR, and cover a base built from a revision before this change. 3. **L3** `scripts/devtools/build.py:185`: The environment supplied to an older Linux base no longer identifies its compiler to that revision. (more on the line) **Do:** Provide an EMSDK-compatible layout or other compatibility environment when building revisions whose toolchain only understands EMSDK, and test that path against the base revision. **Should fix (1)**: not blocking, but worth doing before merging. - **L4** `scripts/tools_store.py:208`: Applying the installed Windows tools sets LONGSHOT_MINGW even when LONGSHOT_MSVC=1 requests the Visual Studio route. (more on the line) **Do:** Honor LONGSHOT_MSVC when applying the compiler environment, and add a test that checks the selected toolchain. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L5**: The new Windows toolchain and offline package have not completed a player build and game run. *When:* The Windows release now links a newly built FFmpeg and supplies new SDL and Python packages; the reported checks inspect archives but do not show that a player's build, movies and controllers work. **Do:** Build and play with the released Windows tools, including VP9 and AV1 movies and controllers, and repeat with the offline zip disconnected on the stated Windows systems. - **L6**: The Linux offline builder has not completed a disconnected game build and play run. *When:* The reported AppImage test reaches the tools-only stage; it does not exercise the compiler, libraries and game produced from the carried tools. **Do:** Build and play using the offline AppImage with the network disconnected, including the affected supported Linux hardware. - **L7** `.forgejo/workflows/release.yml:267`: The new release path has not demonstrated that its integration token can publish the missing archives. (more on the line) **Do:** Exercise a release-equivalent missing-tool upload with the configured Authorized Integration and verify both builder jobs proceed. `@fix` can do L1, L2, L3 and L4. **Checks:** Failing on this head, which is behind its base, where it passes: `Guide screenshots / Guide images and local UI source review (pull_request)`. `@rebase` (or `@fix`) brings it up to date and runs it again; not held against it. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Unproven: the author reports archive sizes and successful tool-stage and packaging checks, but neither platform has completed a game build and play test with these tools. The release upload integration is also untested. **Other systems:** Windows setup, older revisions built through dev.py, Linux AppImage builds, the Launcher, FFmpeg movie decoding, SDL controllers, and release publishing are affected. The supplied runs do not establish end-to-end behavior on Windows or a Linux offline game build. **Switches:** LONGSHOT_LLVM selects an LLVM release directory; LONGSHOT_TOOLS_STORE selects the shared store; --tools-only runs tool preparation; --stamps prints cache stamps; OFFLINE defaults to 1 when producing AppImages. LONGSHOT_MSVC=1 is still documented as selecting MSVC, but the new tool stage overrides that selection in installed Windows builders. **Reviewed:** 7741e4930d4b against 753fb5af6860: Read the repository instructions, contribution rules, PR template and standards; commit history; tools_store.py, tools.py, AppRun, Runner.cs, Windows dependency script, toolchain.py, and relevant setup, packaging, release and build paths. Skimmed the remaining changed diffs, tests, documentation and workflow files; did not read every changed code file in full.; nothing run (a code review). **Checked and fine:** - Every commit in the supplied range has an AI assistance trailer. - The Windows Python lock is included in the release's missing-tool and publish lookup. - The offline package stamps are checked against the corresponding tool hashes before use. **Testing:** Read-only review; no builds, tests or project scripts were run. The author reports Linux tool-stage and AppImage packaging checks, but no completed game run. **Overlaps and merge order:** LongshotLauncher#257 is the stated companion for builder-owned tools and offline imports; its merge order and compatibility need maintainer coordination. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -130,0 +264,4 @@
run: |
[[ -n $AUDIENCE ]] || { echo "::error::no PACKAGES_AUDIENCE variable: docs/dev/reference/releases.md, One-time setup"; exit 1; }
RELEASE_TOKEN=$(curl -fsS --retry 3 -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=$AUDIENCE" | python3 -c 'import json, sys; print(json.load(sys.stdin)["value"])')
Member

L7 (should fix): The new release path has not demonstrated that its integration token can publish the missing archives.

When: When a required archive is absent, both builder jobs wait for tools-publish; a rejected token or registry upload prevents the release from producing either builder.

Do: Exercise a release-equivalent missing-tool upload with the configured Authorized Integration and verify both builder jobs proceed.

**L7** (should fix): The new release path has not demonstrated that its integration token can publish the missing archives. *When:* When a required archive is absent, both builder jobs wait for tools-publish; a rejected token or registry upload prevents the release from producing either builder. **Do:** Exercise a release-equivalent missing-tool upload with the configured Authorized Integration and verify both builder jobs proceed.
@ -248,0 +182,4 @@
found, error = tools_store.ensure(True, ROOT, env, system(), tools_store.text_say())
if error:
die(error)
py_dir = None
Member

L3 (blocking): The environment supplied to an older Linux base no longer identifies its compiler to that revision.

When: dev.py base builds the merge base in a clean worktree, but supplies LONGSHOT_LLVM. The base's toolchain.py only reads EMSDK, so it falls back to a host compiler or fails to find clang; a host compiler can also fail to read the shipped LLVM profile.

Do: Provide an EMSDK-compatible layout or other compatibility environment when building revisions whose toolchain only understands EMSDK, and test that path against the base revision.

**L3** (blocking): The environment supplied to an older Linux base no longer identifies its compiler to that revision. *When:* dev.py base builds the merge base in a clean worktree, but supplies LONGSHOT_LLVM. The base's toolchain.py only reads EMSDK, so it falls back to a host compiler or fails to find clang; a host compiler can also fail to read the shipped LLVM profile. **Do:** Provide an EMSDK-compatible layout or other compatibility environment when building revisions whose toolchain only understands EMSDK, and test that path against the base revision.
@ -404,8 +348,6 @@ def cmd_base(a):
else:
out(["git", "worktree", "add", "--detach", src, commit])
try:
Member

L2 (blocking): Building a base from an older Windows revision no longer puts SDL's DLLs where that revision reads them.

When: dev.py base creates a clean worktree at the merge base. That revision's nx2/build.py only copies SDL2.dll and SDL3.dll from its third_party/sdl2 directory and ignores LONGSHOT_SDL_DIR; the removed windows_prebuilt step leaves that directory without the DLLs, so the resulting game lacks controller support.

Do: Stage the DLLs into older worktrees when their build code does not support LONGSHOT_SDL_DIR, and cover a base built from a revision before this change.

**L2** (blocking): Building a base from an older Windows revision no longer puts SDL's DLLs where that revision reads them. *When:* dev.py base creates a clean worktree at the merge base. That revision's nx2/build.py only copies SDL2.dll and SDL3.dll from its third_party/sdl2 directory and ignores LONGSHOT_SDL_DIR; the removed windows_prebuilt step leaves that directory without the DLLs, so the resulting game lacks controller support. **Do:** Stage the DLLs into older worktrees when their build code does not support LONGSHOT_SDL_DIR, and cover a base built from a revision before this change.
@ -0,0 +205,4 @@
"""ensure, then the variables set in environ for this process and what it starts. Returns the error text or None"""
found, error = ensure(True, root, environ, system, say, getter)
environ.update(environment({n: f for n, f in found.items() if f}, system))
return error
Member

L4 (should fix): Applying the installed Windows tools sets LONGSHOT_MINGW even when LONGSHOT_MSVC=1 requests the Visual Studio route.

When: An installed builder inherits LONGSHOT_MSVC=1. The tools stage sets LONGSHOT_MINGW before bundled_mingw checks the switch, and toolchain.mingw() then selects MinGW for compilation and linking.

Do: Honor LONGSHOT_MSVC when applying the compiler environment, and add a test that checks the selected toolchain.

**L4** (should fix): Applying the installed Windows tools sets LONGSHOT_MINGW even when LONGSHOT_MSVC=1 requests the Visual Studio route. *When:* An installed builder inherits LONGSHOT_MSVC=1. The tools stage sets LONGSHOT_MINGW before bundled_mingw checks the switch, and toolchain.mingw() then selects MinGW for compilation and linking. **Do:** Honor LONGSHOT_MSVC when applying the compiler environment, and add a test that checks the selected toolchain.
build(release): tools-publish uploads as BeanTools with a sealed token (PACKAGES_TOKEN_SEALED), opened only on the deploy runner, in place of an Authorized Integration's token any runner taking the job would get; a64-kit's patch cut to the LONGSHOT_LLVM lookup
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 16s
CI / Website build and checks (pull_request) Has been cancelled
c8f49b8d97
Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean force-pushed build/tools-cleanup from c8f49b8d97
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 6s
CI / Conventional Commit title (pull_request) Successful in 7s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 16s
CI / Website build and checks (pull_request) Has been cancelled
to a44378da56
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Website build and checks (pull_request) Successful in 3m24s
2026-11-23 00:37:40 +00:00
Compare
Author
Owner

Thanks. Fixed in a44378da, on current main:

  • L1 builder/setup/setup.c: an installed version is copied again when it lacks a tool the zip carries (carries_all: each tools\.tools\<name> stamp of the zip, compared with the installed one). An offline zip over the same version's online install now takes its carried tools.
  • L2, L3 scripts/devtools/build.py: dev.py base builds an older revision with that revision's own tools.lock (build_tools(tree)), as it reads them. On Linux its emsdk goes in as EMSDK. On Windows its third-party SDL DLLs go into its third_party/sdl2, as the old windows_prebuilt did, and it uses its own Python. Every older archive is still in the store, which is never pruned.
  • L4 scripts/tools_store.py environment: with LONGSHOT_MSVC=1, llvm-mingw's LONGSHOT_MINGW is left out, so the Visual Studio route stays.
  • L7: there's no Authorized Integration any more. Its token couldn't be limited to our own runners: any runner that took tools-publish would have got it. The upload is now the BeanTools account's write:package token, sealed as PACKAGES_TOKEN_SEALED, opened only on the deploy runner like the release key. The account, its team (Packages: Write alone) and the secret are set up; the secret opens on the server. The first nightly after merge is its first real upload.
  • L5, L6: still to test, as the description says.

Checks for L1 to L4 are in tests/test_offline_builder.py and tests/test_dev_build.py.

Thanks. Fixed in a44378da, on current main: - **L1** `builder/setup/setup.c`: an installed version is copied again when it lacks a tool the zip carries (`carries_all`: each `tools\.tools\<name>` stamp of the zip, compared with the installed one). An offline zip over the same version's online install now takes its carried tools. - **L2, L3** `scripts/devtools/build.py`: `dev.py base` builds an older revision with that revision's own `tools.lock` (`build_tools(tree)`), as it reads them. On Linux its `emsdk` goes in as `EMSDK`. On Windows its `third-party` SDL DLLs go into its `third_party/sdl2`, as the old `windows_prebuilt` did, and it uses its own Python. Every older archive is still in the store, which is never pruned. - **L4** `scripts/tools_store.py` `environment`: with `LONGSHOT_MSVC=1`, llvm-mingw's `LONGSHOT_MINGW` is left out, so the Visual Studio route stays. - **L7**: there's no Authorized Integration any more. Its token couldn't be limited to our own runners: any runner that took `tools-publish` would have got it. The upload is now the BeanTools account's `write:package` token, sealed as `PACKAGES_TOKEN_SEALED`, opened only on the deploy runner like the release key. The account, its team (*Packages: Write* alone) and the secret are set up; the secret opens on the server. The first nightly after merge is its first real upload. - L5, L6: still to test, as the description says. Checks for L1 to L4 are in `tests/test_offline_builder.py` and `tests/test_dev_build.py`.
Author
Owner

Superseded by #2286: the Rust builder now owns its tools (longshot-builder dev tools is tools.lock's one implementation, tools.py is gone) and installs them itself, which is everything this PR set out to do. Closing in its favour.

Superseded by [#2286](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2286): the Rust builder now owns its tools (`longshot-builder dev tools` is tools.lock's one implementation, tools.py is gone) and installs them itself, which is everything this PR set out to do. Closing in its favour.
HumanBean closed this pull request 2026-11-24 03:11:38 +00:00
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 9s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 16s
CI / Workflow lint (actionlint) (pull_request) Successful in 16s
Third-party parts / As their notes say (pull_request) Successful in 18s
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Website build and checks (pull_request) Successful in 3m24s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2295
No description provided.