Add hermetic Windows SDK and MSVC runtime repositories (#37896)

## What changed

- Add pinned `windows_support` repositories for the Windows SDK and MSVC runtime on `x64` and `arm64`.
- Require explicit acceptance through `--repo_env=BAZEL_MSVC_RUNTIME_VISUAL_STUDIO_EULA=1` before materializing the MSVC runtime.
- Preserve case-only SDK aliases when repositories created on case-insensitive Windows filesystems are consumed by case-sensitive remote executors.

GitOrigin-RevId: c7a5278e87c5e7e25e9c5f60af3d99e19303b0fd
This commit is contained in:
Sean Huang
2026-08-10 22:52:57 +00:00
committed by copyberry
parent 9e301c8c9a
commit 92912d6d84
4 changed files with 375 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "protobuf", version = "34.0.bcr.1", repo_name = "com_google_protobuf")
bazel_dep(name = "rules_proto", version = "7.1.0")
bazel_dep(name = "llvm", version = "0.8.11")
bazel_dep(name = "windows_support", version = "0.2.0")
# Patch hermetic LLVM for Codex's custom libc++ and Windows gnullvm runtime
# needs that have not landed upstream.
@@ -20,6 +21,57 @@ single_version_override(
],
)
# Preserve case-only SDK aliases when native Windows repository setup feeds
# case-sensitive remote executors.
single_version_override(
module_name = "windows_support",
patch_strip = 1,
patches = [
"//patches:windows-support-remote-case-aliases.patch",
],
version = "0.2.0",
)
# MSVC repository materialization fails closed until a user who has accepted
# Microsoft's Visual Studio terms explicitly supplies
# --repo_env=BAZEL_MSVC_RUNTIME_VISUAL_STUDIO_EULA=1. Do not configure that
# acceptance globally: Linux, macOS, and Windows GNU do not require it.
msvc_runtime = use_extension("@windows_support//windows:extensions.bzl", "msvc_runtime")
msvc_runtime.configure(
architectures = [
"x64",
"arm64",
],
msvc_version = "14.50.35717",
visual_studio_installer_manifest_integrity = "sha256-qOhU+p8/uurCfXME4pfxZg1xN0ATid61fPeYPzPBb+8=",
visual_studio_installer_manifest_url = "https://download.visualstudio.microsoft.com/download/pr/fdc37f6e-59f6-4054-838a-b476eeaa6ec3/1d82370739911457e0a2f6be15d8b5f569531b352b2eabb961429eea1e99e356/VisualStudio.vsman",
)
use_repo(msvc_runtime, "msvc_runtime")
windows_sdk = use_extension("@windows_support//windows:extensions.bzl", "windows_sdk")
windows_sdk.configure(
architectures = [
"x64",
"arm64",
],
transformations = {
"base/c/Include/10.0.26100.0/shared/driverspecs.h": "base/c/Include/10.0.26100.0/shared/DriverSpecs.h",
"base/c/Include/10.0.26100.0/shared/specstrings.h": "base/c/Include/10.0.26100.0/shared/SpecStrings.h",
"base/c/Include/10.0.26100.0/um/ole2.h": "base/c/Include/10.0.26100.0/um/Ole2.h",
"base/c/Include/10.0.26100.0/um/olectl.h": "base/c/Include/10.0.26100.0/um/OleCtl.h",
"**/*.h": "lowercase",
"**/*.lib": "lowercase",
"**/*.Lib": "lowercase",
},
windows_sdk_integrity = {
"Microsoft.Windows.SDK.CPP": "sha256-/0VWYL7gcadEcVqWZWZvopwHaBV509gVlZqe7FpVZCQ=",
"Microsoft.Windows.SDK.CPP.x64": "sha256-rWzpD/lAEGmdKVSLPCseUsieuBFD4hmRVdmlw4ABtSs=",
"Microsoft.Windows.SDK.CPP.arm64": "sha256-A7wMA9Q5zvhQdLvNQl+dXTptO0Z5Z6zSHaO6bf7q+mc=",
},
windows_sdk_version = "10.0.26100.7705",
)
use_repo(windows_sdk, "windows_sdk")
# Abseil picks a MinGW pthread TLS path that does not match our hermetic
# windows-gnullvm toolchain; force it onto the portable C++11 thread-local path.
single_version_override(