Skip to content

Commit 5e2dcee

Browse files
authored
Remove 10.15 fallback for manifest/plugin compilation (#6526)
This does not seem like a good fallback anymore since e.g. it'll always fail on Apple Silicon machines in case it is reached. Instead, use the default host triple as the fallback. rdar://109066834
1 parent 78cceb7 commit 5e2dcee

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

Sources/PackageLoading/ManifestLoader.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,10 +646,13 @@ public final class ManifestLoader: ManifestLoaderProtocol {
646646
#endif
647647
}
648648

649-
// Use the same minimum deployment target as the PackageDescription library (with a fallback of 10.15).
649+
// Use the same minimum deployment target as the PackageDescription library (with a fallback to the default host triple).
650650
#if os(macOS)
651-
let version = self.toolchain.swiftPMLibrariesLocation.manifestLibraryMinimumDeploymentTarget.versionString
652-
cmd += ["-target", "\(self.toolchain.triple.tripleString(forPlatformVersion: version))"]
651+
if let version = self.toolchain.swiftPMLibrariesLocation.manifestLibraryMinimumDeploymentTarget?.versionString {
652+
cmd += ["-target", "\(self.toolchain.triple.tripleString(forPlatformVersion: version))"]
653+
} else {
654+
cmd += ["-target", self.toolchain.triple.tripleString]
655+
}
653656
#endif
654657

655658
// Add any extra flags required as indicated by the ManifestLoader.

Sources/PackageModel/ToolchainConfiguration.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ extension ToolchainConfiguration {
8787
} else if let manifestLibraryMinimumDeploymentTarget = try? MinimumDeploymentTarget.computeMinimumDeploymentTarget(of: Self.macOSManifestLibraryPath(for: manifestLibraryPath), platform: .macOS) {
8888
self.manifestLibraryMinimumDeploymentTarget = manifestLibraryMinimumDeploymentTarget
8989
} else {
90-
self.manifestLibraryMinimumDeploymentTarget = Self.defaultMinimumDeploymentTarget
90+
self.manifestLibraryMinimumDeploymentTarget = nil
9191
}
9292

9393
if let pluginLibraryMinimumDeploymentTarget {
9494
self.pluginLibraryMinimumDeploymentTarget = pluginLibraryMinimumDeploymentTarget
9595
} else if let pluginLibraryMinimumDeploymentTarget = try? MinimumDeploymentTarget.computeMinimumDeploymentTarget(of: Self.macOSPluginLibraryPath(for: pluginLibraryPath), platform: .macOS) {
9696
self.pluginLibraryMinimumDeploymentTarget = pluginLibraryMinimumDeploymentTarget
9797
} else {
98-
self.pluginLibraryMinimumDeploymentTarget = Self.defaultMinimumDeploymentTarget
98+
self.pluginLibraryMinimumDeploymentTarget = nil
9999
}
100100
#else
101101
precondition(manifestLibraryMinimumDeploymentTarget == nil && pluginLibraryMinimumDeploymentTarget == nil, "deployment targets can only be specified on macOS")
@@ -122,10 +122,8 @@ extension ToolchainConfiguration {
122122
}
123123

124124
#if os(macOS)
125-
private static let defaultMinimumDeploymentTarget = PlatformVersion("10.15")
126-
127-
public var manifestLibraryMinimumDeploymentTarget: PlatformVersion
128-
public var pluginLibraryMinimumDeploymentTarget: PlatformVersion
125+
public var manifestLibraryMinimumDeploymentTarget: PlatformVersion?
126+
public var pluginLibraryMinimumDeploymentTarget: PlatformVersion?
129127

130128
private static func macOSManifestLibraryPath(for manifestAPI: AbsolutePath) -> AbsolutePath {
131129
if manifestAPI.extension == "framework" {

Sources/Workspace/DefaultPluginScriptRunner.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,13 @@ public struct DefaultPluginScriptRunner: PluginScriptRunner, Cancellable {
174174
}
175175
#endif
176176

177-
// Use the same minimum deployment target as the PackageDescription library (with a fallback of 10.15).
177+
// Use the same minimum deployment target as the PackagePlugin library (with a fallback to the default host triple).
178178
#if os(macOS)
179-
let version = self.toolchain.swiftPMLibrariesLocation.pluginLibraryMinimumDeploymentTarget.versionString
180-
commandLine += ["-target", self.hostTriple.tripleString(forPlatformVersion: version)]
179+
if let version = self.toolchain.swiftPMLibrariesLocation.pluginLibraryMinimumDeploymentTarget?.versionString {
180+
commandLine += ["-target", "\(self.toolchain.triple.tripleString(forPlatformVersion: version))"]
181+
} else {
182+
commandLine += ["-target", self.toolchain.triple.tripleString]
183+
}
181184
#endif
182185

183186
// Add any extra flags required as indicated by the ManifestLoader.

0 commit comments

Comments
 (0)