build: find a Preview or Insiders Visual Studio when no stable one has the C++ tools (BUILD-VSWHERE-PRERELEASE) #2066

Closed
leonida/mandy
c0pperlane wants to merge 0 commits from vswhere-prerelease into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

c0pperlane commented 2026-11-25 19:24:01 +00:00

Claimed in the coordination issue as: BUILD-VSWHERE-PRERELEASE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171910784)

Depends on: #1871 (conflicts: both change the vswhere lookup in scripts/build_llvm_mc.ps1; whichever lands second writes the fallback as if (-not $vs) { $vs = & $vswhere -latest -prerelease ... })

What and why

vswhere lists a Preview or Insiders install only when asked with -prerelease, so a machine whose only Visual Studio is a prerelease build was told it had no C++ x64 tools (finding). Four lookups had this: scripts/build_llvm_mc.ps1, scripts/build_runtime.ps1, make_game.py (visual_cpp_tools_ok, the runtime preflight) and tools/hw_oracle/runner.py (find_vcvars). Each now does what .github/workflows/runtime.yml already does: a stable lookup first, then -prerelease only when that returns nothing. A machine with both keeps its stable install (-latest -prerelease alone would let a newer Preview win). git grep -i vswhere finds no other call (Build.bat, Mods.bat and the other scripts have none).

Tests:

  • tests/test_build_vs_lookup.py (new) runs each script's lookup as written against a stub vswhere.exe built with the .NET Framework C# compiler (as test_build_runtime_cmake.py builds its recorder). Cases: prerelease only, stable and prerelease, neither.
  • tests/test_make_game_preflight.py and tests/test_hw_oracle.py stub subprocess.run for the same cases.

Tested

Windows 11 Pro (10.0.26300), Python 3.12.10, rebased on main at e48ff037. Each new test fails on main and passes with this change:

  • python -I tests/test_build_vs_lookup.py: on main FAILED (4 subtests: "Visual Studio with the C++ x64 tools wasn't found." for both scripts); with the change OK
  • python -I tests/test_hw_oracle.py Unavailable.test_vcvars_of_a_prerelease_visual_studio: on main FAILED (None); with the change OK
  • python -I tests/test_make_game_preflight.py PreflightPrerequisiteTest.test_visual_cpp_tools_accepts_a_prerelease_installation: on main FAILED (False); with the change OK

Full files with the change, all OK: test_build_vs_lookup (1), test_hw_oracle (60, 3 skipped), test_make_game_preflight (99, 2 skipped), test_build_llvm_mc_batch (1), test_build_runtime_batch (1), test_build_runtime_cmake (1), test_build_runtime_fallback (10), test_build_percent_path (3), test_text_write_line_endings (3), test_make_game_platform (46, 2 skipped), test_make_game_dry_run (24), test_make_game_pipeline_preflight (20, 1 skipped). python -m compileall -q make_game.py tools tests, python -I make_game.py --help and python -I scripts/check_no_game_data.py on every changed file: exit 0. The two .ps1 files keep CRLF (git ls-files --eol).

Not tested on a machine with only a prerelease Visual Studio (vswhere is stubbed in every test); the finding's author confirmed -prerelease finds an Insiders install.

GPUs tested: n/a

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
Claimed in the coordination issue as: BUILD-VSWHERE-PRERELEASE (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171910784) Depends on: #1871 (conflicts: both change the vswhere lookup in scripts/build_llvm_mc.ps1; whichever lands second writes the fallback as `if (-not $vs) { $vs = & $vswhere -latest -prerelease ... }`) ### What and why vswhere lists a Preview or Insiders install only when asked with `-prerelease`, so a machine whose only Visual Studio is a prerelease build was told it had no C++ x64 tools ([finding](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7171221172)). Four lookups had this: `scripts/build_llvm_mc.ps1`, `scripts/build_runtime.ps1`, `make_game.py` (`visual_cpp_tools_ok`, the runtime preflight) and `tools/hw_oracle/runner.py` (`find_vcvars`). Each now does what `.github/workflows/runtime.yml` already does: a stable lookup first, then `-prerelease` only when that returns nothing. A machine with both keeps its stable install (`-latest -prerelease` alone would let a newer Preview win). `git grep -i vswhere` finds no other call (Build.bat, Mods.bat and the other scripts have none). Tests: - `tests/test_build_vs_lookup.py` (new) runs each script's lookup as written against a stub `vswhere.exe` built with the .NET Framework C# compiler (as `test_build_runtime_cmake.py` builds its recorder). Cases: prerelease only, stable and prerelease, neither. - `tests/test_make_game_preflight.py` and `tests/test_hw_oracle.py` stub `subprocess.run` for the same cases. ### Tested Windows 11 Pro (10.0.26300), Python 3.12.10, rebased on main at e48ff037. Each new test fails on main and passes with this change: - `python -I tests/test_build_vs_lookup.py`: on main FAILED (4 subtests: "Visual Studio with the C++ x64 tools wasn't found." for both scripts); with the change OK - `python -I tests/test_hw_oracle.py Unavailable.test_vcvars_of_a_prerelease_visual_studio`: on main FAILED (`None`); with the change OK - `python -I tests/test_make_game_preflight.py PreflightPrerequisiteTest.test_visual_cpp_tools_accepts_a_prerelease_installation`: on main FAILED (`False`); with the change OK Full files with the change, all OK: test_build_vs_lookup (1), test_hw_oracle (60, 3 skipped), test_make_game_preflight (99, 2 skipped), test_build_llvm_mc_batch (1), test_build_runtime_batch (1), test_build_runtime_cmake (1), test_build_runtime_fallback (10), test_build_percent_path (3), test_text_write_line_endings (3), test_make_game_platform (46, 2 skipped), test_make_game_dry_run (24), test_make_game_pipeline_preflight (20, 1 skipped). `python -m compileall -q make_game.py tools tests`, `python -I make_game.py --help` and `python -I scripts/check_no_game_data.py` on every changed file: exit 0. The two .ps1 files keep CRLF (`git ls-files --eol`). Not tested on a machine with only a prerelease Visual Studio (vswhere is stubbed in every test); the finding's author confirmed `-prerelease` finds an Insiders install. GPUs tested: n/a AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
zmasi commented 2026-11-28 12:57:26 +00:00

#2066 | head 34ea846b245581651d20f963345e50fa2c3d53f8 (merged cleanly with main d48a957bb) | python -I tests/test_build_vs_lookup.py, python -I tests/test_hw_oracle.py, PreflightPrerequisiteTest.test_visual_cpp_tools_accepts_a_prerelease_installation | red on main: test_build_vs_lookup.py FAILED (failures=4), test_hw_oracle.py FAILED (failures=1), test_visual_cpp_tools_accepts_a_prerelease_installation FAIL (Preview/Insiders installs missed without -prerelease fallback) | green on PR+main: test_build_vs_lookup.py 1 OK (6 subtests via .NET Framework csc.exe vswhere.exe stub), test_hw_oracle.py 60 ran, OK (skipped=3), test_make_game_preflight.py 107 passed, 2 skipped (excluding 1 unrelated pre-existing main README.md clone-URL mismatch in test_ensure_submodule_names_the_clone_command_the_readme_gives) | Windows 11 (10.0.26200.9974, powershell.exe 5.1.26100.9818), Python 3.12.10 | AI-assisted: yes

Audited make_game.py, scripts/build_llvm_mc.ps1, scripts/build_runtime.ps1, tools/hw_oracle/runner.py, and all three test suites on Windows 11 PowerShell 5.1 + .NET Framework csc.exe, verifying two-step vswhere lookup (stable query first with no -prerelease call when a stable C++ x64 toolchain exists, followed by -prerelease fallback only when empty) across all four entry points. Also verified tests/test_ci_registration.py (18 OK), tests/test_text_write_line_endings.py (3 OK), and scripts/check_no_game_data.py.

Merge / overlap notes: (1) #2053 covers only scripts/build_llvm_mc.ps1, whereas #2066 covers all four entry points; (2) #1871 also modifies the vswhere.exe lines in scripts/build_llvm_mc.ps1 ($vswhere = Join-Path $installer "vswhere.exe" + Test-Path -LiteralPath $vswhere -PathType Leaf), and reconciling that hunk to invoke & $vswhere -latest -prerelease ... passes both tests/test_build_llvm_mc_prereqs.py (5 OK) and tests/test_build_vs_lookup.py (1 OK).

#2066 | head 34ea846b245581651d20f963345e50fa2c3d53f8 (merged cleanly with main d48a957bb) | `python -I tests/test_build_vs_lookup.py`, `python -I tests/test_hw_oracle.py`, `PreflightPrerequisiteTest.test_visual_cpp_tools_accepts_a_prerelease_installation` | red on main: `test_build_vs_lookup.py` `FAILED (failures=4)`, `test_hw_oracle.py` `FAILED (failures=1)`, `test_visual_cpp_tools_accepts_a_prerelease_installation` `FAIL` (Preview/Insiders installs missed without `-prerelease` fallback) | green on PR+main: `test_build_vs_lookup.py` `1 OK` (6 subtests via `.NET Framework csc.exe` `vswhere.exe` stub), `test_hw_oracle.py` `60 ran, OK (skipped=3)`, `test_make_game_preflight.py` `107 passed, 2 skipped` (excluding 1 unrelated pre-existing `main` `README.md` clone-URL mismatch in `test_ensure_submodule_names_the_clone_command_the_readme_gives`) | Windows 11 (`10.0.26200.9974`, `powershell.exe` `5.1.26100.9818`), Python 3.12.10 | AI-assisted: yes Audited `make_game.py`, `scripts/build_llvm_mc.ps1`, `scripts/build_runtime.ps1`, `tools/hw_oracle/runner.py`, and all three test suites on Windows 11 PowerShell 5.1 + `.NET Framework` `csc.exe`, verifying two-step `vswhere` lookup (stable query first with no `-prerelease` call when a stable C++ x64 toolchain exists, followed by `-prerelease` fallback only when empty) across all four entry points. Also verified `tests/test_ci_registration.py` (`18 OK`), `tests/test_text_write_line_endings.py` (`3 OK`), and `scripts/check_no_game_data.py`. Merge / overlap notes: (1) #2053 covers only `scripts/build_llvm_mc.ps1`, whereas #2066 covers all four entry points; (2) #1871 also modifies the `vswhere.exe` lines in `scripts/build_llvm_mc.ps1` (`$vswhere = Join-Path $installer "vswhere.exe"` + `Test-Path -LiteralPath $vswhere -PathType Leaf`), and reconciling that hunk to invoke `& $vswhere -latest -prerelease ...` passes both `tests/test_build_llvm_mc_prereqs.py` (`5 OK`) and `tests/test_build_vs_lookup.py` (`1 OK`).
TheGeogeo commented 2026-11-28 22:16:49 +00:00

Duplicate check, plus the tests: this PR covers #2060 and #2053. All three add the same -prerelease second lookup to scripts/build_llvm_mc.ps1, so a stable install still wins. Only this one also adds it to make_game.py, scripts/build_runtime.ps1 and tools/hw_oracle/runner.py, with tests. main has no -prerelease anywhere yet.

Tested 34ea846b2 merged (no commit) with main aa918e5d9, Python 3.12.4, Windows 11, CPU only:

  • Green: tests/test_build_vs_lookup.py (1 test, 4 cases) and tests/test_hw_oracle.py (61, 3 skipped) pass. tests/test_make_game_preflight.py gives 110 tests and 1 failure, test_ensure_submodule_names_the_clone_command_the_readme_gives, which fails the same way on plain main (unrelated).
  • Red: with the four scripts back to main, test_prerelease_only_when_no_stable_install fails 4 cases (build_llvm_mc.ps1 and build_runtime.ps1, prerelease only and neither), test_vcvars_of_a_prerelease_visual_studio fails, and so does test_visual_cpp_tools_accepts_a_prerelease_installation.

Suggest keeping this one and closing #2053 and #2060. No blocker from my side. AI-assisted (Claude Code).

Duplicate check, plus the tests: this PR covers #2060 and #2053. All three add the same `-prerelease` second lookup to `scripts/build_llvm_mc.ps1`, so a stable install still wins. Only this one also adds it to `make_game.py`, `scripts/build_runtime.ps1` and `tools/hw_oracle/runner.py`, with tests. `main` has no `-prerelease` anywhere yet. Tested `34ea846b2` merged (no commit) with `main` `aa918e5d9`, Python 3.12.4, Windows 11, CPU only: - Green: `tests/test_build_vs_lookup.py` (1 test, 4 cases) and `tests/test_hw_oracle.py` (61, 3 skipped) pass. `tests/test_make_game_preflight.py` gives 110 tests and 1 failure, `test_ensure_submodule_names_the_clone_command_the_readme_gives`, which fails the same way on plain `main` (unrelated). - Red: with the four scripts back to `main`, `test_prerelease_only_when_no_stable_install` fails 4 cases (`build_llvm_mc.ps1` and `build_runtime.ps1`, prerelease only and neither), `test_vcvars_of_a_prerelease_visual_studio` fails, and so does `test_visual_cpp_tools_accepts_a_prerelease_installation`. Suggest keeping this one and closing #2053 and #2060. No blocker from my side. AI-assisted (Claude Code).
aslan2142 reviewed 2026-12-01 10:47:17 +00:00
aslan2142 left a comment
No description provided.
The `vswhere -prerelease` fallback across `make_game.py`, `scripts/build_llvm_mc.ps1`, `scripts/build_runtime.ps1`, and `tools/hw_oracle/runner.py` (preferring stable installs first) and its test coverage (`tests/test_build_vs_lookup.py`, `tests/test_hw_oracle.py`, `tests/test_make_game_preflight.py`) look clean and well-verified, but requesting changes for merge readiness: 1. **Merge conflict:** Currently conflicts with `main` (in `scripts/build_llvm_mc.ps1` after #1871 landed). 2. **No CI runs:** No CI checks have run on head `34ea846b`. Please rebase onto current `main` to resolve the conflict and ensure CI runs green. *(AI-assisted review.)*
aslan2142 commented 2026-12-01 17:24:55 +00:00

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.
Sign in to join this conversation.
No description provided.