You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Allow building Mozc with Visual Studio 2026 (#1495)
This makes Mozc build on machines where only Visual Studio 2026 is
installed, while keeping Visual Studio 2022 as the default toolchain
on machines where VS 2022 is available. GitHub Actions runners stay on
VS 2022 for the time being; explicit opt-in to VS 2026 when both
versions are present can be added in a subsequent commit.
Three coordinated changes make this work:
1. Have vs_util.py call vswhere twice when the first call returns
nothing: '[17,18)' first to find VS 2022, then '[18,19)' to find
VS 2026. Combined with -latest, the resulting matrix is:
* Only VS 2022 installed -> picks VS 2022 (no behavior change).
* Only VS 2026 installed -> picks VS 2026.
* Both installed -> picks VS 2022 (no behavior change).
2. Pass BAZEL_VC into the installer genrule's command line as
--vs_install_dir, derive vcvarsall.bat from it inside
build_installer.py, and feed it to vs_util as the path hint. Add
--action_env=BAZEL_VC under config:windows_env so Bazel propagates
the value into action environments. Without this, build_installer.py
would run its own vswhere lookup and could pick a different VS than
Bazel did, especially on machines with multiple installs.
3. Pick the CRT redist subfolder dynamically. The subfolder is named
after the platform toolset, not the MSVC compiler version: VS 2022
stayed on toolset v143 even after MSVC ticked into the 14.4x range
(to avoid breaking existing project files / CI pipelines), so its
redist lives under 'Microsoft.VC143.CRT'. VS 2026 jumped the toolset
to v145 (matching MSVC 14.50), skipping v144 entirely; its redist
lives under 'Microsoft.VC145.CRT'. Read VCTOOLSVERSION (which
vcvarsall.bat exports next to VCTOOLSREDISTDIR) and pick the v145
subfolder when the minor component is >=50, otherwise v143.
Closes#1487.
PiperOrigin-RevId: 913010498
0 commit comments