From 90edbea3bcac99056f9bb51d5f8da08c685615e4 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 09:28:05 -0800 Subject: [PATCH 01/12] Test CI --- .bazelci/presubmit.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index f3811b0ee..356e6b1ec 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -132,10 +132,10 @@ tasks: <<: *linux_common # TODO: re-enable when Windows in Bazel CI is properly configured for Swift. - # windows_last_green: - # name: "Last Green Bazel" - # bazel: last_green - # <<: *windows_common + windows_last_green: + name: "Last Green Bazel" + bazel: last_green + <<: *windows_common doc_tests: name: "Doc tests" From 2e425bfc394c2b8b9e0e4f643ce5b3bd2a4acb5e Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:10:54 -0800 Subject: [PATCH 02/12] toolchain --- swift/internal/swift_autoconfiguration.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/swift/internal/swift_autoconfiguration.bzl b/swift/internal/swift_autoconfiguration.bzl index 46f1f3746..27a99652e 100644 --- a/swift/internal/swift_autoconfiguration.bzl +++ b/swift/internal/swift_autoconfiguration.bzl @@ -364,7 +364,10 @@ toolchain( "@platforms//os:windows", "@platforms//cpu:x86_64", ], - target_compatible_with = APPLE_PLATFORMS_CONSTRAINTS[arch], + target_compatible_with = [ + "@platforms//os:windows", + "@platforms//cpu:x86_64", + ], toolchain = ":windows-toolchain", toolchain_type = "{toolchain_type}", visibility = ["//visibility:public"], From 838b23633fc89a3ae4145d9bd2157d5ff0e62cdb Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:12:54 -0800 Subject: [PATCH 03/12] test --- 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 27a99652e..0722ba2ce 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: - return """\ + fail("""\ # No 'swiftc.exe' executable found in $PATH. Not auto-generating a Windows \ Swift toolchain. -""" +""") root = path_to_swiftc.dirname.dirname enabled_features = [ From 04c826a75bbabf9d9167bb68997d2d27d3171cf3 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:18:06 -0800 Subject: [PATCH 04/12] from other pr --- .bazelci/presubmit.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 356e6b1ec..6d72dd771 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -40,10 +40,20 @@ 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=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/..." From afa33fa995ea53545367303f66d73c087987ee92 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:20:38 -0800 Subject: [PATCH 05/12] wut --- 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 0722ba2ce..b1dfbc820 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 37a73f1ec0bfdd2bcbb9c5bf7820493eb2c509fd Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:24:36 -0800 Subject: [PATCH 06/12] clang-cl --- .bazelci/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 6d72dd771..f48debe8e 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -52,6 +52,7 @@ 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%" build_targets: From 4195ba3920064d3a47bd31bb42ff7e7e2526854f Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Fri, 14 Nov 2025 10:25:54 -0800 Subject: [PATCH 07/12] downagrade --- .bazelci/presubmit.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index f48debe8e..3f9f896b2 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -142,10 +142,9 @@ tasks: - .bazelci/update_workspace_to_deps_heads.sh <<: *linux_common - # TODO: re-enable when Windows in Bazel CI is properly configured for Swift. windows_last_green: - name: "Last Green Bazel" - bazel: last_green + name: "Latest Bazel" + bazel: latest <<: *windows_common doc_tests: From 428cd10baf2279f6f6e2d0f10565466a5fadb0f6 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 18:07:08 -0800 Subject: [PATCH 08/12] install --- .bazelci/presubmit.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 3f9f896b2..149ce5b05 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -45,6 +45,9 @@ x_defaults: 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(\"/norestart\") -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 From 8f93e68d2be746b4071d9c04b9ce08165f7d2fd5 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:38:05 -0800 Subject: [PATCH 09/12] Update presubmit.yml --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 149ce5b05..2fe80a7cb 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -47,7 +47,7 @@ x_defaults: 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(\"/norestart\") -Wait -PassThru -Verb RunAs + - PowerShell Start-Process -FilePath ${env:TEMP}\winsdkinstaller.exe -ArgumentList(\"/quiet\", \"/norestart\") -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 From 89e6b3a156bea8ef25fd31ba6d5f7fa1c62b2e0a Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:40:55 -0800 Subject: [PATCH 10/12] Update presubmit.yml --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 2fe80a7cb..2dd4a61bb 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -47,7 +47,7 @@ x_defaults: 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 ${env:TEMP}\winsdkinstaller.exe -ArgumentList(\"/passive\", \"/norestart\", \"/log installer.txt\") -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 From fb5c9ebd549889969488d3e53723cdc310cbc311 Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:47:30 -0800 Subject: [PATCH 11/12] Revert "Update presubmit.yml" This reverts commit 89e6b3a156bea8ef25fd31ba6d5f7fa1c62b2e0a. --- .bazelci/presubmit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 2dd4a61bb..2fe80a7cb 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -47,7 +47,7 @@ x_defaults: 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(\"/passive\", \"/norestart\", \"/log installer.txt\") -Wait -PassThru -Verb RunAs + - PowerShell Start-Process -FilePath ${env:TEMP}\winsdkinstaller.exe -ArgumentList(\"/quiet\", \"/norestart\") -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 From e34fa1d9e6c328416490b5e15f2abbbaa1df64ae Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Tue, 18 Nov 2025 19:53:59 -0800 Subject: [PATCH 12/12] this --- .bazelci/presubmit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 2fe80a7cb..ee53f1c6b 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -48,6 +48,7 @@ x_defaults: - 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