Swift 💖 Windows

It has been a while since I've posted about what has been going on in the World of Windows.

I'm happy to announce that we are effectively at a fully passing test suite (caveat emptor - there are pending patches that are needed)! The official benchmark for this is obviously the runs on Azure, which currently reports 14 failures (with pending patches for most of them),

I think at this point, with pending patches, we should be able to claim that Windows support is as good as macOS and Linux! There are still known deficiencies that need to be addressed (which are being found as means of the work on Foundation).

I have been working on Foundation as well, which is in a better shape than before. It is possible to build it on Windows, though there is pending work to refactor the build a slight bit which will improve things and enable the nightlies to build Foundation as well. However, getting the library to build is only the beginning and running through the test suite should help get some level of confidence in the library functioning properly. To that end, there is a good chunk of the test suite which currently runs and passes, but there is still work to be done there to actually get the library to the level of polish that I would like to see on the library. Others have reported being able to build and use Foundation on Windows as well :-).

The Foundation test suite suite uses XCTest, which needed to be ported to Windows. That work is complete and in tree. With one known issue (which is the cause of the two test failures in the XCTest test suite on Windows), this library is fully functional and passing the complete test suite on Windows and should be considered to be ready for regular use on Windows.

One of the core dependencies in libdispatch, which along with the 1121 merge gained a bunch of improvements for supporting XCTest and Foundation. Timer queues also work on Windows as well, though, File and Socket sources still need to be implemented. Nearly half the test suite builds and passes on Windows now!

llbuild has a partial port to Windows and there are additional pending patches to allow it to build on Windows. swift-package-manager has some work done as well to help move along that port to Windows, but there is still a bunch of work to be done there.

The Windows instructions have been updated to reflect all of this information, and it should be possible for others to replicate this work as well. Overall, it seems that most of the compiler, runtime, and core libraries are now usable on Windows with the test coverage quickly converging to the point where it is nearly as good as the other supported platforms!

Yes, I am aware of the day that this is being posted on, and no, this is not an elaborate hoax!

Happy April Fool's day!
Saleem

CC: @tkremenek

117 Likes

@compnerd +1 = ). Great work my friend!

1 Like

Great work!

Fantastic, keep up the amazing work!!

Thanks so much for this @compnerd
I stepped away from swift back in version 2, due to the lack of windows development. I really fell in love with the language, and I still find myself comparing every other language to it. Thanks again.

1 Like

You're weclome; you may also want to check out GitHub - compnerd/swift-win32: A Windows application framework for Swift if you are interested in Windows development :slight_smile:

2 Likes

Hi @compnerd! Great work and awesome to see you're still fighting the good fight! Hope all is well with you...

Wow! Congratulations that's really impressive!

Now that the last PR for this is being smoke tested (Parse: XFAIL Parse.enum on Windows by compnerd · Pull Request #23859 · apple/swift · GitHub) - that is, the official bots will finally catch up, they currently are reporting 1 failure which is what that PR accounts for - I wonder if we want to add a badge for the Windows build to the status in README.md even though its not in Jenkins. Thoughts @mishal_shah @Rostepher @tkremenek? The tests are running on a frequency of 1/1.5 hours, so, we can quickly catch regressions :slight_smile:

12 Likes

This is brilliant!

To a casual observer, it is not obvious what would need to happen in order for first-class Windows support to be 'done' (if that is indeed the goal), and for 'Windows' to take its place on the Releases page. Is there somewhere that the related tasks are listed?

5 Likes

I would like official Windows support, CI and releases being a Swift Core Team initiative, but if that is not possible, maybe we could encourage them with a Swift Evolution pitch/proposal (maybe once Swift 5.1 is out? "Introducing official Windows support for Swift"?).

If we can review Swift official style guidelines through Swift Evolution I suppose we can also review the introduction of new officially supported platforms, then the last word is from the Core Team, as always.

cc: @tkremenek

The primary thing holding that back is that the official builds need to be run on Jenkins so that they can tie into the builds (which has the problem of build-script-impl being bash and needing to be converted to python). However, @mishal_shah seems willing to help get something going in the mean time where it may be possible to tie builds with Azure (Update README.md by compnerd · Pull Request #23862 · apple/swift · GitHub). I too would love to see the official pages reflect that Windows support is actually quite far along now.

1 Like

@compnerd can we run build-script-impl on The Jenkins windows agent using Powershell

No, build-script-impl is bash and cannot be run on Windows. Jenkins currently is running windows-build.bat, though the Azure CI (the one generating the MSIs and all follows the instructions at swift/WindowsBuild.md at main · apple/swift · GitHub

swift-win32 is great, I like the (plain Win32 API) approach :+1:t2:
Petzold for Swift.

2 Likes