From ea2255a36ef702791d0c2d33a4bb00238006591a Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:55:22 -0800 Subject: [PATCH 01/41] Test windows CI without commands --- .bazelci/presubmit.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index ee53f1c6b..1a422753d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -40,18 +40,6 @@ x_defaults: - "-//test:output_file_map_default" windows_common: &windows_common platform: windows - environment: - SWIFT_VERSION: 6.1.0 - PATH: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - SDKROOT: "%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" - batch_commands: - - echo --- Installing Windows SDK - - curl.exe -L https://go.microsoft.com/fwlink/?linkid=2342616 -o %TEMP%\winsdkinstaller.exe - - PowerShell Start-Process -FilePath ${env:TEMP}\winsdkinstaller.exe -ArgumentList(\"/quiet\", \"/norestart\") -Wait -PassThru -Verb RunAs - - PowerShell Start-Process -FilePath "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" -ArgumentList(\"/amd64\") -Wait -PassThru -Verb RunAs - - echo --- Downloading and installing Swift %SWIFT_VERSION% - - curl.exe -L https://download.swift.org/swift-6.1-release/windows10/swift-6.1-RELEASE/swift-6.1-RELEASE-windows10.exe -o %TEMP%\installer.exe - - PowerShell Start-Process -FilePath ${env:TEMP}\installer.exe -ArgumentList(\"/install\", \"/passive\", \"/norestart\", \"/log log.txt\") -Wait -PassThru -Verb RunAs build_flags: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows From 960fc248b1ee6d87600778628a6a1c61d485889f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:57:14 -0800 Subject: [PATCH 02/41] revert --- swift/internal/swift_autoconfiguration.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/swift/internal/swift_autoconfiguration.bzl b/swift/internal/swift_autoconfiguration.bzl index b1dfbc820..7d28eec28 100644 --- a/swift/internal/swift_autoconfiguration.bzl +++ b/swift/internal/swift_autoconfiguration.bzl @@ -315,10 +315,10 @@ def _create_windows_toolchain(*, repository_ctx): """ path_to_swiftc = repository_ctx.which("swiftc.exe") if not path_to_swiftc: - fail("""\ + return """\ # No 'swiftc.exe' executable found in $PATH. Not auto-generating a Windows \ Swift toolchain. -""") +""" root = path_to_swiftc.dirname.dirname enabled_features = [ From bbd823e055654e00b5277a4b39fdb46ebfb36d1d Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:58:36 -0800 Subject: [PATCH 03/41] woekr --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1a422753d..c772b1a90 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -48,7 +48,7 @@ x_defaults: - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" build_targets: - - "//tools/..." + - "//tools/worker/..." tasks: macos_7: From f86149f46d82dae9a97653e9c2e1d789e73a140f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 20:01:01 -0800 Subject: [PATCH 04/41] more --- .bazelci/presubmit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index c772b1a90..7331ea086 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -44,9 +44,9 @@ x_defaults: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows - "--strategy=SwiftCompile=" - - "--repo_env=CC=clang-cl" - - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" - - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" + # - "--repo_env=CC=clang-cl" + # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" + # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" build_targets: - "//tools/worker/..." From 79d3929cdaabef88a2ef22afa79ff65ebcfed3db Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:07:24 -0800 Subject: [PATCH 05/41] more --- .bazelrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index 781e84433..ac18dd64d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,7 +20,7 @@ build --experimental_enable_aspect_hints # Make sure no warnings slip into the C++ tools we vendor build --features treat_warnings_as_errors # TODO: Remove when we update protobuf -build --copt=-Wno-deprecated-declarations --host_copt=-Wno-deprecated-declarations +# build --copt=-Wno-deprecated-declarations --host_copt=-Wno-deprecated-declarations # The default strategy is worker, which has sandboxing disabled by default, # which can hide issues with non-hermetic bugs. @@ -32,14 +32,14 @@ build:macos --crosstool_top=@local_config_apple_cc//:toolchain build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain # TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/7bb756c1cc580380c689a9141b27e20c7a5d95f3 is in a release -build --per_file_copt="external/.*protobuf.*/src/google/protobuf/stubs/strutil.cc@-Wno-deprecated-declarations" +# build --per_file_copt="external/.*protobuf.*/src/google/protobuf/stubs/strutil.cc@-Wno-deprecated-declarations" # TODO: Use --host_per_file_copt here once we drop bazel 5.x -build --host_cxxopt="-Wno-deprecated-declarations" +# build --host_cxxopt="-Wno-deprecated-declarations" -# TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/85225b83c3386a282bf1e51f1be8bd2ad0bc45d0 is in a release -build --per_file_copt="external/.*protobuf.*/.*.cc@-Wno-unused-function" -# TODO: Use --host_per_file_copt here once we drop bazel 5.x -build --host_cxxopt="-Wno-unused-function" +# # TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/85225b83c3386a282bf1e51f1be8bd2ad0bc45d0 is in a release +# build --per_file_copt="external/.*protobuf.*/.*.cc@-Wno-unused-function" +# # TODO: Use --host_per_file_copt here once we drop bazel 5.x +# build --host_cxxopt="-Wno-unused-function" # The CNIOBoringSSL library uses C++14 features like 'enable_if_t' macro support. # For more details on how to enable this in Bazel: From 08dfb345d37f95d52a62d1a01cb95dd37da3917e Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:09:09 -0800 Subject: [PATCH 06/41] Revert "more" This reverts commit 79d3929cdaabef88a2ef22afa79ff65ebcfed3db. --- .bazelrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.bazelrc b/.bazelrc index ac18dd64d..781e84433 100644 --- a/.bazelrc +++ b/.bazelrc @@ -20,7 +20,7 @@ build --experimental_enable_aspect_hints # Make sure no warnings slip into the C++ tools we vendor build --features treat_warnings_as_errors # TODO: Remove when we update protobuf -# build --copt=-Wno-deprecated-declarations --host_copt=-Wno-deprecated-declarations +build --copt=-Wno-deprecated-declarations --host_copt=-Wno-deprecated-declarations # The default strategy is worker, which has sandboxing disabled by default, # which can hide issues with non-hermetic bugs. @@ -32,14 +32,14 @@ build:macos --crosstool_top=@local_config_apple_cc//:toolchain build:macos --host_crosstool_top=@local_config_apple_cc//:toolchain # TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/7bb756c1cc580380c689a9141b27e20c7a5d95f3 is in a release -# build --per_file_copt="external/.*protobuf.*/src/google/protobuf/stubs/strutil.cc@-Wno-deprecated-declarations" +build --per_file_copt="external/.*protobuf.*/src/google/protobuf/stubs/strutil.cc@-Wno-deprecated-declarations" # TODO: Use --host_per_file_copt here once we drop bazel 5.x -# build --host_cxxopt="-Wno-deprecated-declarations" +build --host_cxxopt="-Wno-deprecated-declarations" -# # TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/85225b83c3386a282bf1e51f1be8bd2ad0bc45d0 is in a release -# build --per_file_copt="external/.*protobuf.*/.*.cc@-Wno-unused-function" -# # TODO: Use --host_per_file_copt here once we drop bazel 5.x -# build --host_cxxopt="-Wno-unused-function" +# TODO: Remove once https://github.com/protocolbuffers/protobuf/commit/85225b83c3386a282bf1e51f1be8bd2ad0bc45d0 is in a release +build --per_file_copt="external/.*protobuf.*/.*.cc@-Wno-unused-function" +# TODO: Use --host_per_file_copt here once we drop bazel 5.x +build --host_cxxopt="-Wno-unused-function" # The CNIOBoringSSL library uses C++14 features like 'enable_if_t' macro support. # For more details on how to enable this in Bazel: From 6d9641402079669c9aeff3f842f58cafb411be49 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:09:16 -0800 Subject: [PATCH 07/41] swift back --- .bazelci/presubmit.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 7331ea086..b9a905208 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -40,11 +40,19 @@ x_defaults: - "-//test:output_file_map_default" windows_common: &windows_common platform: windows + environment: + SWIFT_VERSION: 6.1.0 + PATH: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" + SDKROOT: "%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" + batch_commands: + - echo --- Downloading and installing Swift %SWIFT_VERSION% + - curl.exe -L https://download.swift.org/swift-6.1-release/windows10/swift-6.1-RELEASE/swift-6.1-RELEASE-windows10.exe -o %TEMP%\installer.exe + - PowerShell Start-Process -FilePath ${env:TEMP}\installer.exe -ArgumentList(\"/install\", \"/passive\", \"/norestart\", \"/log log.txt\") -Wait -PassThru -Verb RunAs build_flags: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows - "--strategy=SwiftCompile=" - # - "--repo_env=CC=clang-cl" + - "--repo_env=CC=clang-cl" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" build_targets: From 31403b33d2ed15440a9158b3c993debdeec356bc Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:11:16 -0800 Subject: [PATCH 08/41] dir --- .bazelci/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index b9a905208..f776a668a 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -48,6 +48,7 @@ x_defaults: - echo --- Downloading and installing Swift %SWIFT_VERSION% - curl.exe -L https://download.swift.org/swift-6.1-release/windows10/swift-6.1-RELEASE/swift-6.1-RELEASE-windows10.exe -o %TEMP%\installer.exe - PowerShell Start-Process -FilePath ${env:TEMP}\installer.exe -ArgumentList(\"/install\", \"/passive\", \"/norestart\", \"/log log.txt\") -Wait -PassThru -Verb RunAs + - dir "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin" build_flags: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows From 2d8ab24ce3521fe64acb97b32eb7131c926bcd61 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:13:27 -0800 Subject: [PATCH 09/41] cxx --- .bazelci/presubmit.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index f776a668a..450741ece 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -42,7 +42,7 @@ x_defaults: platform: windows environment: SWIFT_VERSION: 6.1.0 - PATH: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" + Path: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" SDKROOT: "%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" batch_commands: - echo --- Downloading and installing Swift %SWIFT_VERSION% @@ -53,7 +53,8 @@ x_defaults: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows - "--strategy=SwiftCompile=" - - "--repo_env=CC=clang-cl" + - "--repo_env=CC=clang-cl.exe" + - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" build_targets: From b7ce0b4ccef191e0f60069a99aaffa978a660199 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 08:16:23 -0800 Subject: [PATCH 10/41] path --- .bazelci/presubmit.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 450741ece..4a3eb7118 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -57,6 +57,8 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" + - "--repo_env=Path=%Path%" + - "--repo_env=PATH=%Path%" build_targets: - "//tools/worker/..." From d0b226e28742b06cf701e273677af7975aa0fd1d Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:06:19 -0800 Subject: [PATCH 11/41] path --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 4a3eb7118..8ad97fb48 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -57,8 +57,8 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - - "--repo_env=Path=%Path%" - - "--repo_env=PATH=%Path%" + # - "--repo_env=Path=%Path%" + # - "--repo_env=PATH=%Path%" build_targets: - "//tools/worker/..." From 4b639faab9386ce7b1078c5ac766c36c2527bfc1 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:17:05 -0800 Subject: [PATCH 12/41] more --- .bazelci/presubmit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 8ad97fb48..27ea9f1ee 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -53,7 +53,8 @@ x_defaults: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows - "--strategy=SwiftCompile=" - - "--repo_env=CC=clang-cl.exe" + - --repo_env=CC="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang-cl.exe" + - --repo_env=CXX="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang++.exe" - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" From 76fc5a40f74f49c252ec8b5fbc5f9123c62368aa Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:23:28 -0800 Subject: [PATCH 13/41] another --- .bazelci/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 27ea9f1ee..3fd0416c8 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -55,6 +55,7 @@ x_defaults: - "--strategy=SwiftCompile=" - --repo_env=CC="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang-cl.exe" - --repo_env=CXX="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang++.exe" + - --repo_env=USE_CLANG_CL=1 - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" From ccf4670f5406b40ce5b90b592ac75cf344827195 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:25:37 -0800 Subject: [PATCH 14/41] path --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 3fd0416c8..2358b005b 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -59,8 +59,8 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - # - "--repo_env=Path=%Path%" - # - "--repo_env=PATH=%Path%" + - "--repo_env=Path=%Path%" + - "--repo_env=PATH=%Path%" build_targets: - "//tools/worker/..." From 1a010264a4c31d3d5db3f6e55439aadf3c423a7b Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:39:50 -0800 Subject: [PATCH 15/41] vars --- MODULE.bazel | 6 ++++++ rules_cc.patch | 12 ++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 rules_cc.patch diff --git a/MODULE.bazel b/MODULE.bazel index 190bfc335..6fae89046 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -66,3 +66,9 @@ single_version_override( patch_strip = 1, patches = ["//third_party/patches:stardoc-revert-load-statements-in-docs.patch"], ) + +single_version_override( + module_name = "rules_cc", + patch_strip = 1, + patches = ["//:rules_cc.patch"], +) diff --git a/rules_cc.patch b/rules_cc.patch new file mode 100644 index 000000000..d4fc14853 --- /dev/null +++ b/rules_cc.patch @@ -0,0 +1,12 @@ +diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl +index 66ca5fb..f019455 100644 +--- a/cc/private/toolchain/windows_cc_configure.bzl ++++ b/cc/private/toolchain/windows_cc_configure.bzl +@@ -385,6 +385,7 @@ def setup_vc_env_vars(repository_ctx, vc_path, envvars = [], allow_empty = False + for env in envs: + key, value = env.split("=", 1) + env_map[key] = escape_string(value.replace("\\", "\\\\")) if escape else value ++ print(env_map) + + if not allow_empty: + _check_env_vars(env_map, cmd, expected = envvars) From 954db17e748de4c14c5b0601ecf48b760818e63f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:41:49 -0800 Subject: [PATCH 16/41] no path --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 2358b005b..3fd0416c8 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -59,8 +59,8 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - - "--repo_env=Path=%Path%" - - "--repo_env=PATH=%Path%" + # - "--repo_env=Path=%Path%" + # - "--repo_env=PATH=%Path%" build_targets: - "//tools/worker/..." From 16303943076476d2ae1e3418aa6c9cfccd541660 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:53:41 -0800 Subject: [PATCH 17/41] path --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 3fd0416c8..e4d59426d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -59,8 +59,8 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - # - "--repo_env=Path=%Path%" - # - "--repo_env=PATH=%Path%" + - --repo_env=Path="%Path%" + - --repo_env=PATH="%Path%" build_targets: - "//tools/worker/..." From 157851f7445e1bf24e32054f5cd28594854f54f8 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:56:08 -0800 Subject: [PATCH 18/41] path --- .bazelci/presubmit.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index e4d59426d..9b0e29771 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -59,8 +59,10 @@ x_defaults: - "--repo_env=CXX=clang++.exe" # - "--repo_env=SDKROOT=%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" # - "--repo_env=Path=%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" - - --repo_env=Path="%Path%" - - --repo_env=PATH="%Path%" + # - --repo_env=Path="%Path%" + # - --repo_env=PATH="%Path%" + - --repo_env="PATH=$($env:Path)" + build_targets: - "//tools/worker/..." From 859f4503040fd807fb97f2fe901a9ddf3d07bb16 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 21:58:48 -0800 Subject: [PATCH 19/41] patch --- rules_cc.patch | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/rules_cc.patch b/rules_cc.patch index d4fc14853..53248ad69 100644 --- a/rules_cc.patch +++ b/rules_cc.patch @@ -1,5 +1,5 @@ diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index 66ca5fb..f019455 100644 +index 66ca5fb..3003dbc 100644 --- a/cc/private/toolchain/windows_cc_configure.bzl +++ b/cc/private/toolchain/windows_cc_configure.bzl @@ -385,6 +385,7 @@ def setup_vc_env_vars(repository_ctx, vc_path, envvars = [], allow_empty = False @@ -10,3 +10,12 @@ index 66ca5fb..f019455 100644 if not allow_empty: _check_env_vars(env_map, cmd, expected = envvars) +@@ -741,6 +742,8 @@ Header pruning has been disabled since Bazel failed to recognize the output of / + This can result in unnecessary recompilation. + Fix this by installing the English language pack for the Visual Studio installation at {} and run 'bazel sync --configure'.""".format(vc_path)) + ++ print("build tools are ", build_tools) ++ + msvc_vars = { + "%{msvc_env_tmp_" + target_arch + "}": escaped_tmp_dir, + "%{msvc_env_include_" + target_arch + "}": escaped_include_paths, From af9c5c80f0228bbcd581b3648db8ee58a22488c8 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:01:46 -0800 Subject: [PATCH 20/41] llvm --- .bazelci/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 9b0e29771..3474dadfc 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -62,6 +62,7 @@ x_defaults: # - --repo_env=Path="%Path%" # - --repo_env=PATH="%Path%" - --repo_env="PATH=$($env:Path)" + - --repo_env=BAZEL_LLVM="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr" build_targets: - "//tools/worker/..." From 021e79dfc4c78d4708eb76dc021c1625b266bab3 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:06:37 -0800 Subject: [PATCH 21/41] print --- rules_cc.patch | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rules_cc.patch b/rules_cc.patch index 53248ad69..12d02c51c 100644 --- a/rules_cc.patch +++ b/rules_cc.patch @@ -1,5 +1,5 @@ diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index 66ca5fb..3003dbc 100644 +index 66ca5fb..16b5bcf 100644 --- a/cc/private/toolchain/windows_cc_configure.bzl +++ b/cc/private/toolchain/windows_cc_configure.bzl @@ -385,6 +385,7 @@ def setup_vc_env_vars(repository_ctx, vc_path, envvars = [], allow_empty = False @@ -10,7 +10,15 @@ index 66ca5fb..3003dbc 100644 if not allow_empty: _check_env_vars(env_map, cmd, expected = envvars) -@@ -741,6 +742,8 @@ Header pruning has been disabled since Bazel failed to recognize the output of / +@@ -723,6 +724,7 @@ def _get_msvc_vars(repository_ctx, paths, target_arch = "x64", msvc_vars_x64 = N + for path in escaped_include_paths.split(";"): + if path: + escaped_cxx_include_directories.append("\"%s\"" % path) ++ print("abc", build_tools) + if llvm_path: + clang_version = _get_clang_version(repository_ctx, build_tools["CL"]) + clang_dir = _get_clang_dir(repository_ctx, llvm_path, clang_version) +@@ -741,6 +743,8 @@ Header pruning has been disabled since Bazel failed to recognize the output of / This can result in unnecessary recompilation. Fix this by installing the English language pack for the Visual Studio installation at {} and run 'bazel sync --configure'.""".format(vc_path)) From f6e76120ea91062fa81fbc20bc51128242451963 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:11:22 -0800 Subject: [PATCH 22/41] patch --- rules_cc.patch | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/rules_cc.patch b/rules_cc.patch index 12d02c51c..c57e03edb 100644 --- a/rules_cc.patch +++ b/rules_cc.patch @@ -1,5 +1,5 @@ diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index 66ca5fb..16b5bcf 100644 +index 66ca5fb..d768ec6 100644 --- a/cc/private/toolchain/windows_cc_configure.bzl +++ b/cc/private/toolchain/windows_cc_configure.bzl @@ -385,6 +385,7 @@ def setup_vc_env_vars(repository_ctx, vc_path, envvars = [], allow_empty = False @@ -10,7 +10,15 @@ index 66ca5fb..16b5bcf 100644 if not allow_empty: _check_env_vars(env_map, cmd, expected = envvars) -@@ -723,6 +724,7 @@ def _get_msvc_vars(repository_ctx, paths, target_arch = "x64", msvc_vars_x64 = N +@@ -594,6 +595,7 @@ def find_llvm_tool(repository_ctx, llvm_path, tool): + tool_path = llvm_path + "\\bin\\" + tool + + if not repository_ctx.path(tool_path).exists: ++ print("failed to find ", tool_path) + return None + + return tool_path.replace("\\", "/") +@@ -723,6 +725,7 @@ def _get_msvc_vars(repository_ctx, paths, target_arch = "x64", msvc_vars_x64 = N for path in escaped_include_paths.split(";"): if path: escaped_cxx_include_directories.append("\"%s\"" % path) @@ -18,7 +26,7 @@ index 66ca5fb..16b5bcf 100644 if llvm_path: clang_version = _get_clang_version(repository_ctx, build_tools["CL"]) clang_dir = _get_clang_dir(repository_ctx, llvm_path, clang_version) -@@ -741,6 +743,8 @@ Header pruning has been disabled since Bazel failed to recognize the output of / +@@ -741,6 +744,8 @@ Header pruning has been disabled since Bazel failed to recognize the output of / This can result in unnecessary recompilation. Fix this by installing the English language pack for the Visual Studio installation at {} and run 'bazel sync --configure'.""".format(vc_path)) From ac3e400bd0322105afd9315aae560f7ce4ede664 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:13:23 -0800 Subject: [PATCH 23/41] var --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 3474dadfc..55b6a92d1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -62,7 +62,7 @@ x_defaults: # - --repo_env=Path="%Path%" # - --repo_env=PATH="%Path%" - --repo_env="PATH=$($env:Path)" - - --repo_env=BAZEL_LLVM="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr" + - --repo_env=BAZEL_LLVM="$(env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$(env:SWIFT_VERSION)+Asserts\\usr" build_targets: - "//tools/worker/..." From 58ef94f9ebc425423e5c861212a9e3c4312ada9b Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:14:57 -0800 Subject: [PATCH 24/41] typo --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 55b6a92d1..67877dde1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -62,7 +62,7 @@ x_defaults: # - --repo_env=Path="%Path%" # - --repo_env=PATH="%Path%" - --repo_env="PATH=$($env:Path)" - - --repo_env=BAZEL_LLVM="$(env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$(env:SWIFT_VERSION)+Asserts\\usr" + - --repo_env=BAZEL_LLVM="$($env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$($env:SWIFT_VERSION)+Asserts\\usr" build_targets: - "//tools/worker/..." From b448d516b11d0d20b800259fccd44687f6871424 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:18:23 -0800 Subject: [PATCH 25/41] path --- .bazelci/presubmit.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 67877dde1..e7679c783 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -62,7 +62,8 @@ x_defaults: # - --repo_env=Path="%Path%" # - --repo_env=PATH="%Path%" - --repo_env="PATH=$($env:Path)" - - --repo_env=BAZEL_LLVM="$($env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$($env:SWIFT_VERSION)+Asserts\\usr" + # - --repo_env=BAZEL_LLVM="$($env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$($env:SWIFT_VERSION)+Asserts\\usr" + - --repo_env=BAZEL_LLVM="C:/Users/b/AppData/Local/Programs/Swift/Toolchains/6.1.0+Asserts/usr" build_targets: - "//tools/worker/..." From 2be57d990b1187ebe5617d55f8d7620e3b3d64d6 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:21:13 -0800 Subject: [PATCH 26/41] patch --- rules_cc.patch | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/rules_cc.patch b/rules_cc.patch index c57e03edb..96e4f0142 100644 --- a/rules_cc.patch +++ b/rules_cc.patch @@ -1,5 +1,18 @@ +diff --git a/cc/private/toolchain/BUILD.windows.tpl b/cc/private/toolchain/BUILD.windows.tpl +index 1d0f8a0..a3a2aab 100644 +--- a/cc/private/toolchain/BUILD.windows.tpl ++++ b/cc/private/toolchain/BUILD.windows.tpl +@@ -322,7 +322,7 @@ cc_toolchain_config( + "objcopy": "wrapper/bin/msvc_nop.bat", + "objdump": "wrapper/bin/msvc_nop.bat", + "strip": "wrapper/bin/msvc_nop.bat", +- "dumpbin": "%{msvc_dumpbin_path_x64}", ++ # "dumpbin": "%{msvc_dumpbin_path_x64}", + "cpp-module-deps-scanner": "%{msvc_deps_scanner_wrapper_path_x64}", + }, + archiver_flags = ["/MACHINE:X64"], diff --git a/cc/private/toolchain/windows_cc_configure.bzl b/cc/private/toolchain/windows_cc_configure.bzl -index 66ca5fb..d768ec6 100644 +index 66ca5fb..4d8bfed 100644 --- a/cc/private/toolchain/windows_cc_configure.bzl +++ b/cc/private/toolchain/windows_cc_configure.bzl @@ -385,6 +385,7 @@ def setup_vc_env_vars(repository_ctx, vc_path, envvars = [], allow_empty = False @@ -35,3 +48,12 @@ index 66ca5fb..d768ec6 100644 msvc_vars = { "%{msvc_env_tmp_" + target_arch + "}": escaped_tmp_dir, "%{msvc_env_include_" + target_arch + "}": escaped_include_paths, +@@ -751,7 +756,7 @@ Fix this by installing the English language pack for the Visual Studio installat + "%{msvc_ml_path_" + target_arch + "}": build_tools.get("ML", "msvc_arm_toolchain_does_not_support_ml"), + "%{msvc_link_path_" + target_arch + "}": build_tools["LINK"], + "%{msvc_lib_path_" + target_arch + "}": build_tools["LIB"], +- "%{msvc_dumpbin_path_" + target_arch + "}": build_tools["DUMPBIN"], ++ # "%{msvc_dumpbin_path_" + target_arch + "}": build_tools["DUMPBIN"], + "%{msvc_parse_showincludes_" + target_arch + "}": repr(support_parse_showincludes), + "%{dbg_mode_debug_flag_" + target_arch + "}": "/DEBUG:FULL" if support_debug_fastlink else "/DEBUG", + "%{fastbuild_mode_debug_flag_" + target_arch + "}": "/DEBUG:FASTLINK" if support_debug_fastlink else "/DEBUG", From 3d67552f99cc06fe377f87c4f4d790f41fb0d853 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:23:40 -0800 Subject: [PATCH 27/41] warnign --- .bazelrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bazelrc b/.bazelrc index 781e84433..90d130c32 100644 --- a/.bazelrc +++ b/.bazelrc @@ -50,3 +50,5 @@ build:linux --cxxopt='-std=c++14' # There is an open issue about it on the zlib repository here: # https://github.com/madler/zlib/issues/633 build --per_file_copt="external/.*zlib.*/.*.c@-Wno-deprecated-non-prototype" + +build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro-redefined From 2409394faa8043443654af7a3df8e278145a15a1 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:27:18 -0800 Subject: [PATCH 28/41] label --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index e7679c783..cb3845b0d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -66,7 +66,7 @@ x_defaults: - --repo_env=BAZEL_LLVM="C:/Users/b/AppData/Local/Programs/Swift/Toolchains/6.1.0+Asserts/usr" build_targets: - - "//tools/worker/..." + - "//tools/..." tasks: macos_7: From 2f8512a5b40e08bcc639611b60fe7ab8f9c171e6 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:29:15 -0800 Subject: [PATCH 29/41] ignored --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index cb3845b0d..d562d382d 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -53,7 +53,7 @@ x_defaults: # Override 'sandboxed' strategy set in .bazelrc because it's not # available on Windows - "--strategy=SwiftCompile=" - - --repo_env=CC="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang-cl.exe" + - --repo_env=CC=clang - --repo_env=CXX="%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin\\clang++.exe" - --repo_env=USE_CLANG_CL=1 - "--repo_env=CXX=clang++.exe" From 914159bc15f62109fd7eba27987b4cfdaab15a6c Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:31:05 -0800 Subject: [PATCH 30/41] print --- swift/toolchains/swift_toolchain.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl index 43ec029b0..7e13d777b 100644 --- a/swift/toolchains/swift_toolchain.bzl +++ b/swift/toolchains/swift_toolchain.bzl @@ -432,7 +432,8 @@ def _swift_toolchain_impl(ctx): if "clang" not in cc_toolchain.compiler: fail("Swift requires the configured CC toolchain to be LLVM (clang). " + "Either use the locally installed LLVM by setting `CC=clang` in your environment " + - "before invoking Bazel, or configure a Bazel LLVM CC toolchain.") + "before invoking Bazel, or configure a Bazel LLVM CC toolchain." + + "The current CC toolchain uses: {}".format(cc_toolchain.compiler)) if ctx.attr.os == "windows": swift_linkopts_cc_info = _swift_windows_linkopts_cc_info( From f8bc231e8e3e6c102f2e4fda976d176ca920841c Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:33:05 -0800 Subject: [PATCH 31/41] ignore --- swift/toolchains/swift_toolchain.bzl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl index 7e13d777b..2311311a1 100644 --- a/swift/toolchains/swift_toolchain.bzl +++ b/swift/toolchains/swift_toolchain.bzl @@ -429,11 +429,11 @@ def _swift_toolchain_impl(ctx): target_triples.parse(ctx.var.get("CC_TARGET_TRIPLE") or target_system_name), ) - if "clang" not in cc_toolchain.compiler: - fail("Swift requires the configured CC toolchain to be LLVM (clang). " + - "Either use the locally installed LLVM by setting `CC=clang` in your environment " + - "before invoking Bazel, or configure a Bazel LLVM CC toolchain." + - "The current CC toolchain uses: {}".format(cc_toolchain.compiler)) + # if "clang" not in cc_toolchain.compiler: + # fail("Swift requires the configured CC toolchain to be LLVM (clang). " + + # "Either use the locally installed LLVM by setting `CC=clang` in your environment " + + # "before invoking Bazel, or configure a Bazel LLVM CC toolchain." + + # "The current CC toolchain uses: {}".format(cc_toolchain.compiler)) if ctx.attr.os == "windows": swift_linkopts_cc_info = _swift_windows_linkopts_cc_info( From 9ceea6ae99746b557adfa60b6f8abe92611999fd Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Wed, 19 Nov 2025 22:35:26 -0800 Subject: [PATCH 32/41] platform --- .bazelrc | 1 + BUILD | 9 +++++++++ MODULE.bazel | 3 +++ swift/toolchains/swift_toolchain.bzl | 10 +++++----- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.bazelrc b/.bazelrc index 90d130c32..6bffd4254 100644 --- a/.bazelrc +++ b/.bazelrc @@ -52,3 +52,4 @@ build:linux --cxxopt='-std=c++14' build --per_file_copt="external/.*zlib.*/.*.c@-Wno-deprecated-non-prototype" build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro-redefined +build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows diff --git a/BUILD b/BUILD index cdbf2d429..86ebd17c5 100644 --- a/BUILD +++ b/BUILD @@ -15,3 +15,12 @@ filegroup( "//tools:for_bazel_tests", ], ) + +platform( + name = "windows", + constraint_values = [ + "@platforms//cpu:x86_64", + "@platforms//os:windows", + "@bazel_tools//tools/cpp:clang-cl", + ], +) diff --git a/MODULE.bazel b/MODULE.bazel index 6fae89046..6127e6a2f 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -72,3 +72,6 @@ single_version_override( patch_strip = 1, patches = ["//:rules_cc.patch"], ) + +cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") +use_repo(cc_configure, "local_config_cc") diff --git a/swift/toolchains/swift_toolchain.bzl b/swift/toolchains/swift_toolchain.bzl index 2311311a1..7e13d777b 100644 --- a/swift/toolchains/swift_toolchain.bzl +++ b/swift/toolchains/swift_toolchain.bzl @@ -429,11 +429,11 @@ def _swift_toolchain_impl(ctx): target_triples.parse(ctx.var.get("CC_TARGET_TRIPLE") or target_system_name), ) - # if "clang" not in cc_toolchain.compiler: - # fail("Swift requires the configured CC toolchain to be LLVM (clang). " + - # "Either use the locally installed LLVM by setting `CC=clang` in your environment " + - # "before invoking Bazel, or configure a Bazel LLVM CC toolchain." + - # "The current CC toolchain uses: {}".format(cc_toolchain.compiler)) + if "clang" not in cc_toolchain.compiler: + fail("Swift requires the configured CC toolchain to be LLVM (clang). " + + "Either use the locally installed LLVM by setting `CC=clang` in your environment " + + "before invoking Bazel, or configure a Bazel LLVM CC toolchain." + + "The current CC toolchain uses: {}".format(cc_toolchain.compiler)) if ctx.attr.os == "windows": swift_linkopts_cc_info = _swift_windows_linkopts_cc_info( From 09ab7271f40cac7616965977879d384190baf702 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 20 Nov 2025 08:53:31 -0800 Subject: [PATCH 33/41] bump --- .bazelci/presubmit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index d562d382d..1482dd562 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -46,7 +46,7 @@ x_defaults: SDKROOT: "%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" batch_commands: - echo --- Downloading and installing Swift %SWIFT_VERSION% - - curl.exe -L https://download.swift.org/swift-6.1-release/windows10/swift-6.1-RELEASE/swift-6.1-RELEASE-windows10.exe -o %TEMP%\installer.exe + - curl.exe -L https://download.swift.org/swift-6.2.1-release/windows10/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE-windows10.exe -o %TEMP%\installer.exe - PowerShell Start-Process -FilePath ${env:TEMP}\installer.exe -ArgumentList(\"/install\", \"/passive\", \"/norestart\", \"/log log.txt\") -Wait -PassThru -Verb RunAs - dir "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin" build_flags: @@ -63,7 +63,7 @@ x_defaults: # - --repo_env=PATH="%Path%" - --repo_env="PATH=$($env:Path)" # - --repo_env=BAZEL_LLVM="$($env:LOCALAPPDATA)\\Programs\\Swift\\Toolchains\\$($env:SWIFT_VERSION)+Asserts\\usr" - - --repo_env=BAZEL_LLVM="C:/Users/b/AppData/Local/Programs/Swift/Toolchains/6.1.0+Asserts/usr" + - --repo_env=BAZEL_LLVM="C:/Users/b/AppData/Local/Programs/Swift/Toolchains/6.2.1+Asserts/usr" build_targets: - "//tools/..." From 79a0b4eaf0f79e31b4ed69d3f303643ce9744fc2 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 20 Nov 2025 09:00:22 -0800 Subject: [PATCH 34/41] version --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 1482dd562..73c1eb017 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -41,7 +41,7 @@ x_defaults: windows_common: &windows_common platform: windows environment: - SWIFT_VERSION: 6.1.0 + SWIFT_VERSION: 6.2.1 Path: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr\\bin;%LOCALAPPDATA%\\Programs\\Swift\\Runtimes\\%SWIFT_VERSION%\\usr\\bin;%Path%" SDKROOT: "%LOCALAPPDATA%\\Programs\\Swift\\Platforms\\%SWIFT_VERSION%\\Windows.platform\\Developer\\SDKs\\Windows.sdk" batch_commands: From 6727df7a6c3652e211d936f8801d3da312887fe7 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:20:20 -0800 Subject: [PATCH 35/41] newlines --- tools/worker/swift_runner.cc | 2 +- tools/worker/work_processor.cc | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tools/worker/swift_runner.cc b/tools/worker/swift_runner.cc index 6610e589e..80633b690 100644 --- a/tools/worker/swift_runner.cc +++ b/tools/worker/swift_runner.cc @@ -46,7 +46,7 @@ static std::unique_ptr WriteResponseFile( } response_file_stream << ch; } - response_file_stream << "\"\n"; + response_file_stream << "\"" << std::endl; } response_file_stream.close(); diff --git a/tools/worker/work_processor.cc b/tools/worker/work_processor.cc index ac35aaa86..35154d0ba 100644 --- a/tools/worker/work_processor.cc +++ b/tools/worker/work_processor.cc @@ -114,7 +114,7 @@ void WorkProcessor::ProcessWorkRequest( } if (!arg.empty()) { - params_file_stream << arg << '\n'; + params_file_stream << arg << std::endl; } prev_arg = original_arg; @@ -134,18 +134,18 @@ void WorkProcessor::ProcessWorkRequest( .string(); output_file_map.WriteToPath(new_path); - params_file_stream << "-output-file-map\n"; - params_file_stream << new_path << '\n'; + params_file_stream << "-output-file-map" << std::endl; + params_file_stream << new_path << std::endl; // Pass the incremental flags only if WMO is disabled. WMO would overrule // incremental mode anyway, but since we control the passing of this flag, // there's no reason to pass it when it's a no-op. - params_file_stream << "-incremental\n"; + params_file_stream << "-incremental" << std::endl; } else { // If WMO or -dump-ast is forcing us out of incremental mode, just put the // original output file map back so the outputs end up where they should. - params_file_stream << "-output-file-map\n"; - params_file_stream << output_file_map_path << '\n'; + params_file_stream << "-output-file-map" << std::endl; + params_file_stream << output_file_map_path << std::endl; } } @@ -198,7 +198,7 @@ void WorkProcessor::ProcessWorkRequest( std::filesystem::create_directories(dir_path, ec); if (ec) { stderr_stream << "swift_worker: Could not create directory " << dir_path - << " (" << ec.message() << ")\n"; + << " (" << ec.message() << ")" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } @@ -222,7 +222,7 @@ void WorkProcessor::ProcessWorkRequest( stderr_stream << "swift_worker: Could not copy " << expected_object_pair.second << " to " << expected_object_pair.first << " (" << ec.message() - << ")\n"; + << ")" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } @@ -238,7 +238,7 @@ void WorkProcessor::ProcessWorkRequest( std::filesystem::remove(cleanup_output, ec); if (ec) { stderr_stream << "swift_worker: Could not remove " << cleanup_output - << " (" << ec.message() << ")\n"; + << " (" << ec.message() << ")" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } @@ -265,7 +265,7 @@ void WorkProcessor::ProcessWorkRequest( stderr_stream << "swift_worker: Could not copy " << expected_object_pair.second << " to " << expected_object_pair.first << " (" << ec.message() - << ")\n"; + << ")" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } @@ -286,13 +286,13 @@ void WorkProcessor::ProcessWorkRequest( stderr_stream << "swift_worker: Could not copy " << expected_object_pair.first << " to " << expected_object_pair.second << " (" << ec.message() - << ")\n"; + << ")" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } } else if (exit_code == 0) { stderr_stream << "Failed to copy " << expected_object_pair.first - << " for incremental builds, maybe it wasn't produced?\n"; + << " for incremental builds, maybe it wasn't produced?" << std::endl; FinalizeWorkRequest(request, response, EXIT_FAILURE, stderr_stream); return; } From c89c29b5279eabee14de43f1913de63211a1f15c Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:28:01 -0800 Subject: [PATCH 36/41] features --- .bazelrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelrc b/.bazelrc index 6bffd4254..0671e7b8a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -53,3 +53,4 @@ build --per_file_copt="external/.*zlib.*/.*.c@-Wno-deprecated-non-prototype" build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro-redefined build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows +build:windows --features=-compiler_param_file --host_features=-compiler_param_file From faac3d0ccc76218e81f5e40e2c791358624984bc Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:33:49 -0800 Subject: [PATCH 37/41] wmo --- .bazelrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.bazelrc b/.bazelrc index 0671e7b8a..01d9395e1 100644 --- a/.bazelrc +++ b/.bazelrc @@ -4,6 +4,10 @@ common --incompatible_allow_tags_propagation # Fail if a glob doesn't match anything (https://github.com/bazelbuild/bazel/issues/8195) build --incompatible_disallow_empty_glob +# Easier syntax for passing swiftc flags +common --flag_alias=swiftcopt=@build_bazel_rules_swift//swift:copt +common --flag_alias=host_swiftcopt=@build_bazel_rules_swift//swift:exec_copt + build --host_macos_minimum_os=14.0 build --macos_minimum_os=14.0 @@ -54,3 +58,4 @@ build --per_file_copt="external/.*zlib.*/.*.c@-Wno-deprecated-non-prototype" build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro-redefined build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows build:windows --features=-compiler_param_file --host_features=-compiler_param_file +build:windows --swiftcopt=-wmo --host_swiftcopt=-wmo From 43b40a086fe1a098746fcbc4d7090b54ff31109d Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:36:20 -0800 Subject: [PATCH 38/41] standalone --- .bazelrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelrc b/.bazelrc index 01d9395e1..beb763710 100644 --- a/.bazelrc +++ b/.bazelrc @@ -59,3 +59,4 @@ build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows build:windows --features=-compiler_param_file --host_features=-compiler_param_file build:windows --swiftcopt=-wmo --host_swiftcopt=-wmo +build:windows --strategy=SwiftCompile=standalone From f6d48866c07acc999ba81d0b94208c6bcbfd5942 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:38:44 -0800 Subject: [PATCH 39/41] try w/o sandboxing --- .bazelrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index beb763710..b1b31337d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -59,4 +59,4 @@ build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows build:windows --features=-compiler_param_file --host_features=-compiler_param_file build:windows --swiftcopt=-wmo --host_swiftcopt=-wmo -build:windows --strategy=SwiftCompile=standalone +build:windows --worker_sandboxing=false From 02b817826bd09f5ddd980d2bf16024eb32584dc2 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:43:04 -0800 Subject: [PATCH 40/41] debug --- .bazelrc | 1 + swift/internal/swift_autoconfiguration.bzl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index b1b31337d..aa4bb914a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -59,4 +59,5 @@ build:windows --copt=-Wno-builtin-macro-redefined --host_copt=-Wno-builtin-macro build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:windows build:windows --features=-compiler_param_file --host_features=-compiler_param_file build:windows --swiftcopt=-wmo --host_swiftcopt=-wmo +build:windows --swiftcopt=-v --host_swiftcopt=-v build:windows --worker_sandboxing=false diff --git a/swift/internal/swift_autoconfiguration.bzl b/swift/internal/swift_autoconfiguration.bzl index 7d28eec28..27a99652e 100644 --- a/swift/internal/swift_autoconfiguration.bzl +++ b/swift/internal/swift_autoconfiguration.bzl @@ -341,7 +341,7 @@ Swift toolchain. env = { "Path": repository_ctx.os.environ["Path"] if "Path" in repository_ctx.os.environ else repository_ctx.os.environ["PATH"], - # "ProgramData": repository_ctx.os.environ["ProgramData"], + "ProgramData": repository_ctx.os.environ["ProgramData"], } return """\ From 8978c0394f0fa839cac08bd818451df1b4e4eeba Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 21 Nov 2025 20:45:44 -0800 Subject: [PATCH 41/41] capitalizaed --- swift/internal/swift_autoconfiguration.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/swift/internal/swift_autoconfiguration.bzl b/swift/internal/swift_autoconfiguration.bzl index 27a99652e..0cc460562 100644 --- a/swift/internal/swift_autoconfiguration.bzl +++ b/swift/internal/swift_autoconfiguration.bzl @@ -341,7 +341,7 @@ Swift toolchain. env = { "Path": repository_ctx.os.environ["Path"] if "Path" in repository_ctx.os.environ else repository_ctx.os.environ["PATH"], - "ProgramData": repository_ctx.os.environ["ProgramData"], + "ProgramData": repository_ctx.os.environ["ProgramData"] if "ProgramData" in repository_ctx.os.environ else repository_ctx.os.environ["PROGRAMDATA"], } return """\