-
Notifications
You must be signed in to change notification settings - Fork 195
/
Package.swift
181 lines (163 loc) · 5.83 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// swift-tools-version:5.7
import PackageDescription
import class Foundation.ProcessInfo
let macOSPlatform: SupportedPlatform
if let deploymentTarget = ProcessInfo.processInfo.environment["SWIFTPM_MACOS_DEPLOYMENT_TARGET"] {
macOSPlatform = .macOS(deploymentTarget)
} else {
macOSPlatform = .macOS(.v12)
}
let package = Package(
name: "swift-driver",
platforms: [
macOSPlatform,
.iOS(.v15),
],
products: [
.executable(
name: "swift-driver",
targets: ["swift-driver"]),
.executable(
name: "swift-help",
targets: ["swift-help"]),
.executable(
name: "swift-build-sdk-interfaces",
targets: ["swift-build-sdk-interfaces"]),
.library(
name: "SwiftDriver",
targets: ["SwiftDriver"]),
.library(
name: "SwiftDriverDynamic",
type: .dynamic,
targets: ["SwiftDriver"]),
.library(
name: "SwiftOptions",
targets: ["SwiftOptions"]),
.library(
name: "SwiftDriverExecution",
targets: ["SwiftDriverExecution"]),
],
targets: [
/// C modules wrapper for _InternalLibSwiftScan.
.target(name: "CSwiftScan",
exclude: [ "CMakeLists.txt" ]),
/// The driver library.
.target(
name: "SwiftDriver",
dependencies: [
"SwiftOptions",
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
"CSwiftScan",
.product(name: "Yams", package: "yams"),
],
exclude: ["CMakeLists.txt"]),
/// The execution library.
.target(
name: "SwiftDriverExecution",
dependencies: [
"SwiftDriver",
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core")
],
exclude: ["CMakeLists.txt"]),
/// Driver tests.
.testTarget(
name: "SwiftDriverTests",
dependencies: ["SwiftDriver", "SwiftDriverExecution", "TestUtilities", "ToolingTestShim"]),
/// IncrementalImport tests
.testTarget(
name: "IncrementalImportTests",
dependencies: [
"IncrementalTestFramework",
"TestUtilities",
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
]),
.target(
name: "IncrementalTestFramework",
dependencies: [ "SwiftDriver", "SwiftOptions", "TestUtilities" ],
path: "Tests/IncrementalTestFramework",
linkerSettings: [
.linkedFramework("XCTest", .when(platforms: [.iOS, .macOS, .tvOS, .watchOS]))
]),
.target(
name: "TestUtilities",
dependencies: ["SwiftDriver", "SwiftDriverExecution"],
path: "Tests/TestUtilities"),
.target(
name: "ToolingTestShim",
dependencies: ["SwiftDriver"],
path: "Tests/ToolingTestShim"),
/// The options library.
.target(
name: "SwiftOptions",
dependencies: [
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
],
exclude: ["CMakeLists.txt"]),
.testTarget(
name: "SwiftOptionsTests",
dependencies: ["SwiftOptions"]),
/// The primary driver executable.
.executableTarget(
name: "swift-driver",
dependencies: ["SwiftDriverExecution", "SwiftDriver"],
exclude: ["CMakeLists.txt"]),
/// The help executable.
.executableTarget(
name: "swift-help",
dependencies: [
"SwiftOptions",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
],
exclude: ["CMakeLists.txt"]),
/// Build SDK Interfaces tool executable.
.executableTarget(
name: "swift-build-sdk-interfaces",
dependencies: ["SwiftDriver", "SwiftDriverExecution"],
exclude: ["CMakeLists.txt"]),
/// The `makeOptions` utility (for importing option definitions).
.executableTarget(
name: "makeOptions",
dependencies: [],
// Do not enforce checks for LLVM's ABI-breaking build settings.
// makeOptions runtime uses some header-only code from LLVM's ADT classes,
// but we do not want to link libSupport into the executable.
cxxSettings: [.unsafeFlags(["-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1"])]),
],
cxxLanguageStandard: .cxx17
)
if ProcessInfo.processInfo.environment["SWIFT_DRIVER_LLBUILD_FWK"] == nil {
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
package.dependencies += [
.package(url: "https://github.com/apple/swift-llbuild.git", branch: "main"),
]
package.targets.first(where: { $0.name == "SwiftDriverExecution" })!.dependencies += [
.product(name: "llbuildSwift", package: "swift-llbuild"),
]
} else {
// In Swift CI, use a local path to llbuild to interoperate with tools
// like `update-checkout`, which control the sources externally.
package.dependencies += [
.package(name: "llbuild", path: "../llbuild"),
]
package.targets.first(where: { $0.name == "SwiftDriverExecution" })!.dependencies += [
.product(name: "llbuildSwift", package: "llbuild"),
]
}
}
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
package.dependencies += [
.package(url: "https://github.com/apple/swift-tools-support-core.git", branch: "main"),
.package(url: "https://github.com/jpsim/Yams.git", .upToNextMinor(from: "5.1.0")),
// The 'swift-argument-parser' version declared here must match that
// used by 'swift-package-manager' and 'sourcekit-lsp'. Please coordinate
// dependency version changes here with those projects.
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"),
]
} else {
package.dependencies += [
.package(path: "../swift-tools-support-core"),
.package(path: "../yams"),
.package(path: "../swift-argument-parser"),
]
}