Skip to content

Commit b19825a

Browse files
committed
Respect SWIFTPM_MACOS_DEPLOYMENT_TARGET when set (such as during Swift toolchain build)
Respect `SWIFTPM_MACOS_DEPLOYMENT_TARGET` if it is set in the environment, otherwise stay with the default minimum deployment target of 10.10 on macOS. This aligns with both swift-package-manager and with swift-driver, and is important now that ToolSupportCore has started containing some code that is annotated with availability for Darwin platforms. One can discuss whether it should be `SWIFTTSC_MACOS_DEPLOYMENT_TARGET`, but since swift-driver uses the SwiftPM setting (and this is what the Swift toolchain sets), it seems reasonable to stick with that.
1 parent fc5b8a5 commit b19825a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Package.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
This source file is part of the Swift.org open source project
55

6-
Copyright (c) 2019 - 2020 Apple Inc. and the Swift project authors
6+
Copyright (c) 2019 - 2021 Apple Inc. and the Swift project authors
77
Licensed under Apache License v2.0 with Runtime Library Exception
88

99
See http://swift.org/LICENSE.txt for license information
@@ -12,9 +12,20 @@
1212

1313

1414
import PackageDescription
15+
import class Foundation.ProcessInfo
16+
17+
let macOSPlatform: SupportedPlatform
18+
if let deploymentTarget = ProcessInfo.processInfo.environment["SWIFTPM_MACOS_DEPLOYMENT_TARGET"] {
19+
macOSPlatform = .macOS(deploymentTarget)
20+
} else {
21+
macOSPlatform = .macOS(.v10_10)
22+
}
1523

1624
let package = Package(
1725
name: "swift-tools-support-core",
26+
platforms: [
27+
macOSPlatform,
28+
],
1829
products: [
1930
.library(
2031
name: "SwiftToolsSupport",

0 commit comments

Comments
 (0)