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

Open
github-bot wants to merge 1 commit from github-bot/gh-2066 into main AGit
Owner

@⁠c0pperlane on GitHub · 2026-11-25 19:24 UTC · original
c0pperlane:vswhere-prerelease → main · +162 −10 · 7 files · 1 commits · open

Claimed in the coordination issue as: BUILD-VSWHERE-PRERELEASE (#1608)

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.
**@⁠c0pperlane** on GitHub · 2026-11-25 19:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2066) `c0pperlane:vswhere-prerelease` → `main` · +162 −10 · 7 files · 1 commits · open Claimed in the coordination issue as: BUILD-VSWHERE-PRERELEASE (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608)). 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.
vswhere lists a prerelease install only when asked with -prerelease, so a
machine whose only Visual Studio is a Preview or Insiders build was reported
as having no C++ x64 tools by scripts/build_llvm_mc.ps1,
scripts/build_runtime.ps1, make_game.py's preflight (visual_cpp_tools_ok) and
tools/hw_oracle/runner.py (find_vcvars). Each now asks for a stable install
first and, only when that returns nothing, asks again with -prerelease: the
pattern .github/workflows/runtime.yml already uses. A machine with both keeps
the stable install, as -latest alone would otherwise let a newer Preview win.
No other vswhere call is in the repository.

tests/test_build_vs_lookup.py 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): prerelease only, stable and
prerelease, neither. test_make_game_preflight.py and test_hw_oracle.py stub
subprocess.run for the same cases. All three fail without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:16:40 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2066/head:github-bot/gh-2066'
git switch 'github-bot/gh-2066'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2066'
git switch 'github-bot/gh-2066'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2066'
git switch 'github-bot/gh-2066'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2066'
git switch 'main'
git merge --squash 'github-bot/gh-2066'
git switch 'main'
git merge --ff-only 'github-bot/gh-2066'
git switch 'main'
git merge 'github-bot/gh-2066'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.