-
Notifications
You must be signed in to change notification settings - Fork 195
/
Package.swift
151 lines (135 loc) · 4.79 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
// swift-tools-version:5.1
// In order to support users running on the latest Xcodes, please ensure that
// [email protected] is kept in sync with this file.
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(.v10_15)
}
let package = Package(
name: "swift-driver",
platforms: [
macOSPlatform,
.iOS(.v13),
],
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"),
/// The driver library.
.target(
name: "SwiftDriver",
dependencies: ["SwiftOptions", "SwiftToolsSupport-auto",
"CSwiftScan", "Yams"],
exclude: ["CMakeLists.txt", "SwiftDriver.docc"]),
/// The execution library.
.target(
name: "SwiftDriverExecution",
dependencies: ["SwiftDriver", "SwiftToolsSupport-auto"],
exclude: ["CMakeLists.txt"]),
/// Driver tests.
.testTarget(
name: "SwiftDriverTests",
dependencies: ["SwiftDriver", "SwiftDriverExecution", "swift-driver",
"TestUtilities"]),
/// IncrementalImport tests
.testTarget(
name: "IncrementalImportTests",
dependencies: ["IncrementalTestFramework", "TestUtilities", "SwiftToolsSupport-auto"]),
.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"),
/// The options library.
.target(
name: "SwiftOptions",
dependencies: ["SwiftToolsSupport-auto"],
exclude: ["CMakeLists.txt"]),
.testTarget(
name: "SwiftOptionsTests",
dependencies: ["SwiftOptions"]),
/// The primary driver executable.
.target(
name: "swift-driver",
dependencies: ["SwiftDriverExecution", "SwiftDriver"],
exclude: ["CMakeLists.txt"]),
/// The help executable.
.target(
name: "swift-help",
dependencies: ["SwiftOptions", "ArgumentParser", "SwiftToolsSupport-auto"],
exclude: ["CMakeLists.txt"]),
/// The help executable.
.target(
name: "swift-build-sdk-interfaces",
dependencies: ["SwiftDriver", "SwiftDriverExecution"],
exclude: ["CMakeLists.txt"]),
/// The `makeOptions` utility (for importing option definitions).
.target(
name: "makeOptions",
dependencies: []),
],
cxxLanguageStandard: .cxx14
)
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")),
]
} 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(path: "../llbuild"),
]
}
package.targets.first(where: { $0.name == "SwiftDriverExecution" })!.dependencies += ["llbuildSwift"]
}
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.0.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", .upToNextMinor(from: "1.0.1")),
]
} else {
package.dependencies += [
.package(path: "../swift-tools-support-core"),
.package(path: "../yams"),
.package(path: "../swift-argument-parser"),
]
}