Skip to content

Commit fc903cf

Browse files
committed
Enable Swift 6 mode unless we are in a self-hosted Swift CI job
We disable Swift 6 mode when the `SWIFTCI_IS_SELF_HOSTED` environment variable is set to work around the following issue: The self-hosted SwiftPM job has Xcode 15.3 (Swift 5.10) installed and builds a Swift 6 SwiftPM from source. It then tries to build itself as a fat binary using the just-built Swift 6 SwiftPM, which uses xcbuild from Xcode as the build system. But the xcbuild in the installed Xcode is too old and doesn't know about Swift 6 mode, so it fails with: SWIFT_VERSION '6' is unsupported, supported versions are: 4.0, 4.2, 5.0 (rdar://126952308)
1 parent 94e1cc9 commit fc903cf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,12 @@ let package = Package(
298298
exclude: ["Inputs"]
299299
),
300300
],
301-
swiftLanguageVersions: [.v5]
301+
// Disable Swift 6 mode when the `SWIFTSYNTAX_DISABLE_SWIFT_6_MODE` environment variable is set. This works around the following
302+
// issue: The self-hosted SwiftPM job has Xcode 15.3 (Swift 5.10) installed and builds a Swift 6 SwiftPM from source.
303+
// It then tries to build itself as a fat binary using the just-built Swift 6 SwiftPM, which uses xcbuild from Xcode
304+
// as the build system. But the xcbuild in the installed Xcode is too old and doesn't know about Swift 6 mode, so it
305+
// fails with: SWIFT_VERSION '6' is unsupported, supported versions are: 4.0, 4.2, 5.0 (rdar://126952308)
306+
swiftLanguageVersions: hasEnvironmentVariable("SWIFTSYNTAX_DISABLE_SWIFT_6_MODE") ? [.v5] : [.v5, .version("6")]
302307
)
303308

304309
// This is a fake target that depends on all targets in the package.

0 commit comments

Comments
 (0)