diff --git a/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift b/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift index 691619cfa6a..800f223205a 100644 --- a/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift +++ b/Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift @@ -251,7 +251,9 @@ final class ProjectEditorMapper: ProjectEditorMapping { var packagesSettings = targetBaseSettings( projectFrameworkPath: projectDescriptionPath, pluginHelperLibraryPaths: pluginProjectDescriptionHelpersModule.map(\.path), - swiftVersion: swiftVersion + // We have no use of strict concurrency in the Packages targets, so we're opting into the Swift 5 language mode. + // Otherwise, `PackageDescription` must be imported with the `@preconcurrency` modifier + swiftVersion: Version(5, 0, 0).description ) packagesSettings.merge( [ diff --git a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift index e53255fab6e..db87a90d613 100644 --- a/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift +++ b/Tests/TuistKitTests/ProjectEditor/ProjectEditorMapperTests.swift @@ -220,6 +220,7 @@ final class ProjectEditorMapperTests: TuistUnitTestCase { "SWIFT_INCLUDE_PATHS": .array([ "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/pm/ManifestAPI", ]), + "SWIFT_VERSION": "5.0.0", ], uniquingKeysWith: { switch ($0, $1) { diff --git a/fixtures/app_with_spm_dependencies/Tuist/Package.swift b/fixtures/app_with_spm_dependencies/Tuist/Package.swift index 480fcdcd912..e8a2d080067 100644 --- a/fixtures/app_with_spm_dependencies/Tuist/Package.swift +++ b/fixtures/app_with_spm_dependencies/Tuist/Package.swift @@ -1,5 +1,5 @@ // swift-tools-version: 6.0 -@preconcurrency import PackageDescription +import PackageDescription #if TUIST import ProjectDescription