Skip to content

Commit

Permalink
Fix compiling Package.swift without @preconcurrency import modifier i…
Browse files Browse the repository at this point in the history
…n project generated by tuist edit (tuist#7333)
  • Loading branch information
fortmarek authored Feb 19, 2025
1 parent 435ae3a commit 56961cf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Sources/TuistKit/ProjectEditor/ProjectEditorMapper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion fixtures/app_with_spm_dependencies/Tuist/Package.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// swift-tools-version: 6.0
@preconcurrency import PackageDescription
import PackageDescription

#if TUIST
import ProjectDescription
Expand Down

0 comments on commit 56961cf

Please sign in to comment.