Repository navigation
[Windows] Build swiftly on Windows and list toolchains from Windows Installer - #619
Open
AbdAlRahmanGad wants to merge 3 commits into
Open
AbdAlRahmanGad wants to merge 3 commits into
AbdAlRahmanGad wants to merge 3 commits into
Conversation
swift-nio-ssl, which AsyncHTTPClient pulls in, doesn't compile against the Windows SDK, so SwiftlyCore couldn't build on Windows. Keep the same OpenAPI clients and give them openapi-winhttp-transport there, with AsyncHTTPClient unchanged on Linux and macOS. Each transport package is declared only on the platforms that use it: openapi-winhttp-transport needs tools 6.4, and declaring it everywhere would break builds with older toolchains. Resolving it moves swift-openapi-runtime from 1.9.0 to 1.12.1.
Add a WindowsPlatform target and wire it into Swiftly.currentPlatform. Toolchain install, lookup, signature checks and running toolchains throw "isn't supported on Windows yet" until they go through Windows Installer. Give the Unix-only SwiftlyCore helpers Windows versions next to their definitions: installSwiftlyBin does nothing (swiftly's installer puts it in place), findSwiftlyBin returns nil (Windows proxies will be stub executables), and proxyEnvironment throws for now. Fix the paths that broke at runtime: - argv[0] on Windows has backslashes and .exe, so swiftly.exe always took itself for a proxy. Strip both before comparing. - TerminationStatus on Windows only has .exited(DWORD). - Self-update throws instead of hitting fatalError or picking the Linux download. - init no longer edits a Unix shell profile or prints a `. env.sh` hint; Windows has no profile to source. Every change is a new #if branch, so Linux and macOS are unchanged.
AbdAlRahmanGad
requested review from
cmcgee1024,
etcwilde,
justice-adams-apple and
shahmishal
as code owners
November 9, 2026 05:38
Add Platform.discoverInstalledToolchains for platforms where something other than swiftly's configuration records what's installed. It returns nil by default, so Linux and macOS keep using config.json. On Windows, the swift.org installers register each toolchain, SDK and runtime with Windows Installer. List the products whose publisher is swift.org, walk the components in the install contexts they use, and identify each piece by its key file (swift.exe, SDKSettings.json, swiftCore.dll). A CMsi shim declares the five msi.dll functions, which don't import through the WinSDK module. swiftly list now shows toolchains installed from swift.org, and findToolchainLocation returns their real install folder.
AbdAlRahmanGad
force-pushed
the
windows-build
branch
from
November 9, 2026 06:13
4f83e5d to
82dfcf2
Compare
compnerd
reviewed
Nov 9, 2026
| @@ -0,0 +1,40 @@ | |||
| #pragma once | |||
Member
There was a problem hiding this comment.
Why do we need this? Can we not use WinSDK to get the appropriate header pulled in?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The beginning of bringing Swiftly to Windows. See the Swift Forums proposal.
swiftly now builds and runs on Windows. The OpenAPI clients use openapi-winhttp-transport there (swift-nio-ssl doesn't compile against the Windows SDK), and installed toolchains come from Windows Installer's records of the swift.org MSIs; Linux and macOS are unchanged.
Works on Windows
swift build --product swiftlybuild Swiftlyswiftly init --skip-install: sets up swiftly's home directory; skips the shell profile, which Windows doesn't haveswiftly --version,swiftly --helpswiftly list: shows toolchains installed with the swift.org installerswiftly list-available: fetches the release list from swift.org over WinHTTPswiftly use,swiftly use <version>,swiftly use --print-location: shows or picks the in-use toolchain