feat(pr-build): build longshot_vk.dll/.so only for renderer-only PRs (RX_VK_ONLY=1) #270

Closed
Jer9 wants to merge 1 commit from Jer9/LongshotLauncher:feat/pr-build-fast-vk into main
First-time contributor

Summary

Building an open Longshot PR from the Launcher (#199) currently runs a full nx2/make_game.py lift, compile, and link (~10–15 minutes) even when the PR only edits renderer code under gpu/vk/. When a matching base nightly build is already installed, only longshot_vk.dll (Windows) or longshot_vk.so (Linux) needs to be rebuilt.

This PR adds a conservative, fail-closed renderer-only fast path for PR builds:

  1. Diff classifier (Core/FastVkBuild.cs): Classifies the PR's changed files against Longshot's renderer-only contract (mirroring scripts/devtools/packs.py:route(), checking host/ #include references, and checking nx2/build.py host_deps). Any change touching host/, nx2/, assets/, third_party/, shaders/build rules outside the standalone renderer, or MKWVK_API_VERSION fails closed to a full make_game.py build.
  2. Base-nightly & ABI parity guard (Core/FastVkBuild.cs, Core/Toolchains.cs): Records PR build metadata (pr-meta.json) in Toolchains.InstallPullRequest, locates a matching installed base nightly, verifies MKWVK_API_VERSION parity between the PR source and base, and fails closed to a full build if no compatible base is installed.
  3. Fast standalone renderer build & staging (Core/MakeGameCommand.cs, Core/FastVkBuild.cs, App/ViewModels/BuildStepViewModel.cs): Invokes nx2/build.py --standalone with RX_VK_ONLY=1 and RX_RELEASE=1 (preserving OOT_WORK and PGO profile wiring) and stages the resulting longshot_vk.dll/.so paired with the base nightly folder via StageFromBase.

What a player / tester notices:

  • Testing a renderer-only Longshot PR (gpu/vk/) in the Launcher drops from a full ~14-minute rebuild to under ~1 minute once a matching nightly is installed, with automatic transparent fallback to a full build whenever a PR touches host/ABI/game code.

Helps:

  • Windows and Linux Launcher users testing open renderer PRs on the pr track.

No measurable impact:

  • Normal stable/nightly installs, or PRs that touch host/, nx2/, assets/, or MKWVK_API_VERSION (which continue running full make_game.py).

Files to read first:

  • Core/FastVkBuild.cs: diff classification, MKWVK_API_VERSION parity check, and StageFromBase pairing.
  • Core/MakeGameCommand.cs: MakeGameCommand.ForFastVk command construction (RX_VK_ONLY=1).
  • Core/Toolchains.cs and App/ViewModels/BuildStepViewModel.cs: pr-meta.json recording and build-step routing.
  • tests/launcher_core/FastVkBuildChecks.cs: unit tests covering renderer-only acceptance, fail-closed cases (host/ABI/build/missing base), and staging.

Testing

Tested:

  • Windows 11 (build 26200, .NET SDK):
    • dotnet build LongshotLauncher.slnx -c Release: 0 warnings, 0 errors.
    • LauncherAppTests: PASS.
    • LauncherCoreTests (PullRequestChecks, FastVkBuildChecks, CommandLineChecks): PASS (the only failing check in LauncherCoreTests on this non-admin Windows machine is the pre-existing symlink privilege test at SavesChecks.cs:1003, identical on origin/main).
    • python -I scripts/translations.py: 0 new faults (48 pre-existing on origin/main).

How to test:

  1. Install a current Longshot nightly in the Launcher.
  2. Select an open renderer-only PR (e.g. a PR touching only gpu/vk/*.cpp / .h without bumping MKWVK_API_VERSION) and start a PR build; verify the Launcher runs nx2/build.py --standalone with RX_VK_ONLY=1 and pairs the built longshot_vk.dll/.so with the base nightly.
  3. Select a PR that modifies host/, nx2/, or MKWVK_API_VERSION (or test without a matching base nightly installed) and verify it falls back cleanly to full make_game.py.

Still to test:

  • Live end-to-end Launcher PR build on Windows and Linux against an open renderer-only PR and a host-touching PR (by hand)

Measurements

No runtime game code is changed; build-time speedup comes from invoking Longshot's existing RX_VK_ONLY=1 standalone renderer path (nx2/build.py --standalone, typically < 60 s incremental / clean renderer build) instead of full nx2/make_game.py (~14 min). Exact wall-clock timing depends on CPU core count and warm obj-store state.

Risks

  • Fail-closed safety: Any unrecognized file path, host/ include, MKWVK_API_VERSION mismatch, or missing base nightly automatically falls back to a full make_game.py build rather than producing a broken binary pair.
  • Saves & existing installs: Base nightly folders are never modified in place; the PR install is staged into its own PR version folder.
  • Reverting: A plain revert restores full make_game.py for all PR builds; no user settings or saves are altered.
## Summary Building an open Longshot PR from the Launcher (`#199`) currently runs a full `nx2/make_game.py` lift, compile, and link (~10–15 minutes) even when the PR only edits renderer code under `gpu/vk/`. When a matching base nightly build is already installed, only `longshot_vk.dll` (Windows) or `longshot_vk.so` (Linux) needs to be rebuilt. This PR adds a conservative, fail-closed renderer-only fast path for PR builds: 1. **Diff classifier (`Core/FastVkBuild.cs`):** Classifies the PR's changed files against Longshot's renderer-only contract (mirroring `scripts/devtools/packs.py:route()`, checking `host/` `#include` references, and checking `nx2/build.py` `host_deps`). Any change touching `host/`, `nx2/`, `assets/`, `third_party/`, shaders/build rules outside the standalone renderer, or `MKWVK_API_VERSION` fails closed to a full `make_game.py` build. 2. **Base-nightly & ABI parity guard (`Core/FastVkBuild.cs`, `Core/Toolchains.cs`):** Records PR build metadata (`pr-meta.json`) in `Toolchains.InstallPullRequest`, locates a matching installed base nightly, verifies `MKWVK_API_VERSION` parity between the PR source and base, and fails closed to a full build if no compatible base is installed. 3. **Fast standalone renderer build & staging (`Core/MakeGameCommand.cs`, `Core/FastVkBuild.cs`, `App/ViewModels/BuildStepViewModel.cs`):** Invokes `nx2/build.py --standalone` with `RX_VK_ONLY=1` and `RX_RELEASE=1` (preserving `OOT_WORK` and PGO profile wiring) and stages the resulting `longshot_vk.dll`/`.so` paired with the base nightly folder via `StageFromBase`. **What a player / tester notices:** - Testing a renderer-only Longshot PR (`gpu/vk/`) in the Launcher drops from a full ~14-minute rebuild to under ~1 minute once a matching nightly is installed, with automatic transparent fallback to a full build whenever a PR touches host/ABI/game code. **Helps:** - Windows and Linux Launcher users testing open renderer PRs on the `pr` track. **No measurable impact:** - Normal stable/nightly installs, or PRs that touch `host/`, `nx2/`, `assets/`, or `MKWVK_API_VERSION` (which continue running full `make_game.py`). Files to read first: - `Core/FastVkBuild.cs`: diff classification, `MKWVK_API_VERSION` parity check, and `StageFromBase` pairing. - `Core/MakeGameCommand.cs`: `MakeGameCommand.ForFastVk` command construction (`RX_VK_ONLY=1`). - `Core/Toolchains.cs` and `App/ViewModels/BuildStepViewModel.cs`: `pr-meta.json` recording and build-step routing. - `tests/launcher_core/FastVkBuildChecks.cs`: unit tests covering renderer-only acceptance, fail-closed cases (host/ABI/build/missing base), and staging. ## Testing **Tested:** - Windows 11 (build 26200, .NET SDK): - `dotnet build LongshotLauncher.slnx -c Release`: **0 warnings, 0 errors**. - `LauncherAppTests`: **PASS**. - `LauncherCoreTests` (`PullRequestChecks`, `FastVkBuildChecks`, `CommandLineChecks`): **PASS** (the only failing check in `LauncherCoreTests` on this non-admin Windows machine is the pre-existing symlink privilege test at `SavesChecks.cs:1003`, identical on `origin/main`). - `python -I scripts/translations.py`: `0` new faults (`48` pre-existing on `origin/main`). **How to test:** 1. Install a current Longshot nightly in the Launcher. 2. Select an open renderer-only PR (e.g. a PR touching only `gpu/vk/*.cpp` / `.h` without bumping `MKWVK_API_VERSION`) and start a PR build; verify the Launcher runs `nx2/build.py --standalone` with `RX_VK_ONLY=1` and pairs the built `longshot_vk.dll`/`.so` with the base nightly. 3. Select a PR that modifies `host/`, `nx2/`, or `MKWVK_API_VERSION` (or test without a matching base nightly installed) and verify it falls back cleanly to full `make_game.py`. **Still to test:** - Live end-to-end Launcher PR build on Windows and Linux against an open renderer-only PR and a host-touching PR (by hand) ## Measurements No runtime game code is changed; build-time speedup comes from invoking Longshot's existing `RX_VK_ONLY=1` standalone renderer path (`nx2/build.py --standalone`, typically < 60 s incremental / clean renderer build) instead of full `nx2/make_game.py` (~14 min). Exact wall-clock timing depends on CPU core count and warm `obj-store` state. ## Risks - **Fail-closed safety:** Any unrecognized file path, `host/` include, `MKWVK_API_VERSION` mismatch, or missing base nightly automatically falls back to a full `make_game.py` build rather than producing a broken binary pair. - **Saves & existing installs:** Base nightly folders are never modified in place; the PR install is staged into its own PR version folder. - **Reverting:** A plain revert restores full `make_game.py` for all PR builds; no user settings or saves are altered.
feat(pr-build): build longshot_vk.dll/.so only for renderer-only PRs
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions
e085b31862
Classify PR source diffs against Longshot's renderer-only contract (packs.py route() + host/#include + nx2/build.py host_deps), verify exact installed base nightly and MKWVK_API_VERSION parity, and invoke nx2/build.py --standalone with RX_VK_ONLY=1 before pairing the built renderer with the base nightly folder. Fails closed to full make_game.py on any host/ABI/build/asset change or missing base.

Assisted-by: Antigravity
Member

Possibly related, for context:

  • PR #271 feat(pr-build): allow selecting and stacking multiple open PRs with pre-build conflict preview — Stacked PR explicitly inherits and depends on this fast-build path.
Possibly related, for context: - PR #271 feat(pr-build): allow selecting and stacking multiple open PRs with pre-build conflict preview — Stacked PR explicitly inherits and depends on this fast-build path.
Author
First-time contributor

Closing as superseded by the Rust + Slint launcher rewrite (#284) and forge/mod-api's Rust longshot-builder (which removed nx2/build.py, nx2/make_game.py, RX_VK_ONLY=1, and the packs.py "vk" route, and shares compiled objects via <cache>/store).

A local backup ref is preserved (backup/feat/pr-build-fast-vk). Multi-PR stack support (#271) has been ported independently onto #284 using longshot-builder from-source --archive.

Closing as superseded by the Rust + Slint launcher rewrite (#284) and `forge/mod-api`'s Rust `longshot-builder` (which removed `nx2/build.py`, `nx2/make_game.py`, `RX_VK_ONLY=1`, and the `packs.py` `"vk"` route, and shares compiled objects via `<cache>/store`). A local backup ref is preserved (`backup/feat/pr-build-fast-vk`). Multi-PR stack support (`#271`) has been ported independently onto `#284` using `longshot-builder from-source --archive`.
Jer9 closed this pull request 2026-11-26 14:17:37 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Compile and test (pull_request) Blocked by required conditions

Pull request closed

Some workflows are waiting to be reviewed.
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/LongshotLauncher!270
No description provided.