Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: complete the Windows CI coverage #1295

Closed
wants to merge 14 commits into from
31 changes: 26 additions & 5 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,30 @@ x_defaults:
- "-//test:output_file_map_default"
windows_common: &windows_common
platform: windows
environment:
SWIFT_VERSION: 0.0.0
CC: "clang-cl"
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"
BAZEL_LLVM: "%LOCALAPPDATA%\\Programs\\Swift\\Toolchains\\%SWIFT_VERSION%+Asserts\\usr"
build_flags:
# Override 'sandboxed' strategy set in .bazelrc because it's not
# available on Windows
- "--strategy=SwiftCompile="
- "--compiler=clang-cl"
# TODO: Use the new way of setting toolchains.
- "--noincompatible_enable_cc_toolchain_resolution"
build_targets:
- "//tools/..."
test_flags:
- "--compiler=clang-cl"
# TODO: Use the new way of setting toolchains.
- "--noincompatible_enable_cc_toolchain_resolution"
test_targets:
- "//examples/..."
- "-//examples/apple/..."
# TODO: Fix gRPC on Windows
- "-//examples/xplatform/grpc/..."

tasks:
macos_6:
Expand Down Expand Up @@ -120,11 +138,14 @@ 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: "Last Green Bazel"
bazel: last_green
batch_commands:
- echo --- Downloading and installing Swift %SWIFT_VERSION%
- curl.exe -L https://download.swift.org/swift-5.10-branch/windows10/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a/swift-5.10-DEVELOPMENT-SNAPSHOT-2024-01-18-a-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
<<: *windows_common

doc_tests:
name: "Doc tests"
Expand Down
2 changes: 1 addition & 1 deletion swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def _create_windows_toolchain(repository_ctx):

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"],
}

repository_ctx.file(
Expand Down
5 changes: 3 additions & 2 deletions swift/toolchains/swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,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. " +
"Found compiler is %s." % cc_toolchain.compiler)

if ctx.attr.os == "windows":
swift_linkopts_cc_info = _swift_windows_linkopts_cc_info(
Expand Down Expand Up @@ -505,7 +506,7 @@ def _swift_toolchain_impl(ctx):
xctest = paths.normalize(paths.join(ctx.attr.sdkroot, "..", "..", "Library", "XCTest-{}".format(ctx.attr.xctest_version), "usr", bindir))
env = dicts.add(
ctx.attr.env,
{"Path": xctest + ";" + ctx.attr.env["Path"]},
{"Path": xctest + ";" + ctx.attr.env["PATH"]},
)
else:
env = ctx.attr.env
Expand Down