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

Open
opened 2026-11-26 21:19:56 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2066
Author: @c0pperlane
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: vswhere-prerelease


📝 Commits (1)

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

📊 Changes

7 files changed (+162 additions, -10 deletions)

View changed files

📝 make_game.py (+11 -7)
📝 scripts/build_llvm_mc.ps1 (+2 -0)
📝 scripts/build_runtime.ps1 (+2 -0)
➕ tests/test_build_vs_lookup.py (+93 -0)
📝 tests/test_hw_oracle.py (+31 -0)
📝 tests/test_make_game_preflight.py (+16 -0)
📝 tools/hw_oracle/runner.py (+7 -3)

📄 Description

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.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2066 **Author:** [@c0pperlane](https://github.com/c0pperlane) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `vswhere-prerelease` --- ### 📝 Commits (1) - [`34ea846`](https://github.com/ubiquitarianism/leonida/commit/34ea846b245581651d20f963345e50fa2c3d53f8) build: find a Preview or Insiders Visual Studio when no stable one has the C++ tools (BUILD-VSWHERE-PRERELEASE) ### 📊 Changes **7 files changed** (+162 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+11 -7) 📝 `scripts/build_llvm_mc.ps1` (+2 -0) 📝 `scripts/build_runtime.ps1` (+2 -0) ➕ `tests/test_build_vs_lookup.py` (+93 -0) 📝 `tests/test_hw_oracle.py` (+31 -0) 📝 `tests/test_make_game_preflight.py` (+16 -0) 📝 `tools/hw_oracle/runner.py` (+7 -3) </details> ### 📄 Description 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
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
starred/leonida#2072
No description provided.