Skip to content
Draft

Test CI #1615

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,25 @@ 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
- "--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:
- "//tools/..."

Expand Down Expand Up @@ -131,11 +146,10 @@ 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
# <<: *windows_common
windows_last_green:
name: "Latest Bazel"
bazel: latest
<<: *windows_common

doc_tests:
name: "Doc tests"
Expand Down
11 changes: 7 additions & 4 deletions swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand All @@ -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 """\
Expand All @@ -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"],
Expand Down