New project announcement: Swift compiler driver reimplementation in Swift

Hello Swift Community,

The swift-driver project is a new implementation of the Swift compiler driver that is intended to replace the existing driver with a more extensible, maintainable, and robust code base. The Swift compiler’s driver is what handles the build of a Swift module: it runs the Swift compiler frontend to compile source code to object files, the linker to link those object files into a library or executable, and so on, and contains much of the knowledge of how to produce working programs for any given platform. The driver is the main program that build systems (e.g. SwiftPM, xcodebuild, make, ninja) interact with to compile Swift code, so it is a key piece of infrastructure for building Swift code. The new swift-driver is architected as a Swift library, allowing for deeper integration with the Swift Package Manager.

The new swift-driver is designed to be a drop-in replacement for the existing Swift compiler driver. It is already suitable for many build tasks on Darwin and Linux, but there is also a significant amount of functionality that still needs to be implemented for it to become a viable replacement for the existing driver. swift-driver is open source as part of the Swift project, and we could use your help to make that happen! No compiler experience is necessary, and it’s a relatively small Swift code base using modern Swift development practices (SwiftPM, Foundation, XCTest, etc.) with a specific development plan containing tasks for all skill levels.

Once we have reached feature parity with the existing driver, we intend to deprecate the existing driver and replace it with this new implementation.

Thank you,
Doug

106 Likes

Oh wow, I hope this is just the first of re-writing the Swift compiler using Swift itself (in the very very long term). I'll try to take a closer look soon and see if there is anything even I could help with. Love it. :star_struck:

10 Likes

This is great!!

Do you need to create a new component in bugs.swift.org for this project, or which existing component may we use when creating tickets?

Could we explore using GitHub issues?

21 Likes

We are going to keep all issue tracking in a consolidated place for the Swift project for the time being.

2 Likes

Hi @Douglas_Gregor – How will bootstrap work on platforms that don't already have Swift installed?

2 Likes

You'll need Swift to build Swift. If you don't have Swift on the platform you're targeting, you'll need to cross-compile. We're going to cross this bridge at some point, and it'll probably require us to improve our cross-compilation story.

Doug

6 Likes

In my dreams, we would have a Swift compiler compiled to WASM which could be used to bootstrap pretty-much any target.

2 Likes

And what about bots and CI? I assume there will be a new “two stage/phase” bot, right? Will two phase testing be required for pull requests?

This post was flagged by the community and is temporarily hidden.

Terms of Service

Privacy Policy

Cookie Policy