Skip to content

Commit 6a70ec9

Browse files
Adapt Package.swift to SWIFTCI_USE_LOCAL_DEPS convention (#102)
This change is a preparation for the upcoming integration with the utils/build-script pipeline.
1 parent 0bff459 commit 6a70ec9

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

Package.swift

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ let package = Package(
1313
targets: ["GeneratorCLI"]
1414
),
1515
],
16-
dependencies: [
17-
// Dependencies declare other packages that this package depends on.
18-
.package(url: "https://github.com/apple/swift-system", from: "1.2.1"),
19-
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
20-
.package(url: "https://github.com/apple/swift-async-algorithms.git", exact: "1.0.0-beta.1"),
21-
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
22-
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.5"),
23-
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.1.0"),
24-
.package(url: "https://github.com/apple/swift-nio.git", from: "2.63.0"),
25-
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"),
26-
],
2716
targets: [
2817
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2918
// Targets can depend on other targets in this package, and on products in packages this package depends on.
@@ -119,13 +108,16 @@ let package = Package(
119108

120109
struct Configuration {
121110
let useAsyncHttpClient: Bool
122-
init(SWIFT_SDK_GENERATOR_DISABLE_AHC: Bool) {
123-
self.useAsyncHttpClient = !SWIFT_SDK_GENERATOR_DISABLE_AHC
111+
let useLocalDependencies: Bool
112+
init(SWIFT_SDK_GENERATOR_DISABLE_AHC: Bool, SWIFTCI_USE_LOCAL_DEPS: Bool) {
113+
self.useAsyncHttpClient = !SWIFT_SDK_GENERATOR_DISABLE_AHC && !SWIFTCI_USE_LOCAL_DEPS
114+
self.useLocalDependencies = SWIFTCI_USE_LOCAL_DEPS
124115
}
125116
}
126117

127118
let configuration = Configuration(
128-
SWIFT_SDK_GENERATOR_DISABLE_AHC: Context.environment["SWIFT_SDK_GENERATOR_DISABLE_AHC"] != nil
119+
SWIFT_SDK_GENERATOR_DISABLE_AHC: Context.environment["SWIFT_SDK_GENERATOR_DISABLE_AHC"] != nil,
120+
SWIFTCI_USE_LOCAL_DEPS: Context.environment["SWIFTCI_USE_LOCAL_DEPS"] != nil
129121
)
130122

131123
if configuration.useAsyncHttpClient {
@@ -139,3 +131,27 @@ if configuration.useAsyncHttpClient {
139131
)
140132
}
141133
}
134+
135+
if configuration.useLocalDependencies {
136+
package.dependencies += [
137+
.package(path: "../swift-system"),
138+
.package(path: "../swift-argument-parser"),
139+
.package(path: "../swift-async-algorithms"),
140+
.package(path: "../swift-atomics"),
141+
.package(path: "../swift-collections"),
142+
.package(path: "../swift-crypto"),
143+
.package(path: "../swift-nio"),
144+
.package(path: "../swift-log"),
145+
]
146+
} else {
147+
package.dependencies += [
148+
.package(url: "https://github.com/apple/swift-system", from: "1.2.1"),
149+
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
150+
.package(url: "https://github.com/apple/swift-async-algorithms.git", exact: "1.0.0-beta.1"),
151+
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
152+
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.5"),
153+
.package(url: "https://github.com/apple/swift-crypto.git", from: "3.1.0"),
154+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.63.0"),
155+
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"),
156+
]
157+
}

0 commit comments

Comments
 (0)