Swift 💖 Windows


(Saleem Abdulrasool) #1

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!

CC: @tkremenek

(Michael Gottesman) #2

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

(Alloy) #3

Great work!

(Riley Testut) #4

Fantastic, keep up the amazing work!!

(Bartimus) #5

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.

(Saleem Abdulrasool) #6

You're weclome; you may also want to check out https://github.com/compnerd/swift-win32 if you are interested in Windows development :slight_smile:

(Taqi Jaffri) #7

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!

(Saleem Abdulrasool) #9

Now that the last PR for this is being smoke tested (https://github.com/apple/swift/pull/23859) - 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:

(Jared Khan) #10

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?

(Pedro José Pereira Vieito) #11

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

(Saleem Abdulrasool) #12

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 (https://github.com/apple/swift/pull/23862). I too would love to see the official pages reflect that Windows support is actually quite far along now.