Skip to content

Commit b333a2b

Browse files
committed
Respect SWIFT_TOOLCHAIN_MACOS_DEPLOYMENT_TARGET when set (such as during Swift toolchain build)
If it is not set in the environment, 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. It uses the more project-neutral name `SWIFT_TOOLCHAIN_MACOS_DEPLOYMENT_TARGET` and the expectation is that both SwiftPM and SwiftDriver will switch to using it as well.
1 parent d6c996e commit b333a2b

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["SWIFT_TOOLCHAIN_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)