-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Dynamically determine the swift compiler version. #8707
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
Dynamically determine the swift compiler version. #8707
Conversation
Prebuilts for macros and the automated downloading of SwiftSDKs need to know the version of the compiler so we can fetch compatible binaries. The swiftc compiler has a --print-target-info options which dumps out a JSON structure that contains the compilerVersion. We already use info in this structure to determine the hostTriple for the UserToolchain. This adds the swiftCompilerVersion to UserToolchain that uses a couple of regex's to pull out the Swift compiler version. This is then used by the prebuilts feature instead of our current hardcodeing of the swift toolchain version. This also turns the prebuilts feature on by default which was supposed to be done in the last update.
@swift-ci please test |
return nil | ||
} | ||
|
||
// Extract the swift version using regex from the description if available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure what you have captures the necessary variations, but here is what SwiftBuild is doing for the record: https://github.com/swiftlang/swift-build/blob/8e71bde5ac572174bc7e65f505abf3559bf05455/Sources/SWBCore/SpecImplementations/Tools/SwiftCompiler.swift#L3607
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm about to put a patch up for swift-build. It's way too specific right now 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the mocks failed. Another commit incoming.
The mocks we use in the tests need to be able to provide their own swift version since the swift compiler path is usually faked out.
@swift-ci please test |
@swift-ci please test windows |
Prebuilts for macros and the automated downloading of SwiftSDKs need to know the version of the compiler so we can fetch compatible binaries. The swiftc compiler has a --print-target-info options which dumps out a JSON structure that contains the compilerVersion. We already use info in this structure to determine the hostTriple for the UserToolchain.
This adds the swiftCompilerVersion to UserToolchain that uses a couple of regex's to pull out the Swift compiler version. This is then used by the prebuilts feature instead of our current hardcodeing of the swift toolchain version.
This also turns the prebuilts feature on by default which was supposed to be done in the last update.