Skip to content

Commit b279723

Browse files
compnerdgwynne
andauthored
build: fix dependencies (#599)
* build: fix dependencies We need this to use the new initialiser `init(url:exact:)` for updating the standalone build to match the CI build. When building in CI, we would build against swift-crypto 2.5.0 as per update-checkout-config.json in apple/swift. Adjust the standalone builds to match. When building on CI, we would build against swift-argument-parser 1.2.2 as per update-checkout-config.json in apple/swift. Make the standalone builds match. * - Update Package.swift for Swift 5.6 minimum (as already required by NIO). - Remove deprecated usages and bump the dependency version requirements for NIO, ArgumentParser, and SwiftCrypto (most especially the latter so that updates in the 2.x series are available). - Remove old #if swift conditionals no longer required - Package.resolved now uses the version 2 format * The platform-specific handling for conforming Array to LMDBData is still required. --------- Co-authored-by: Gwynne Raskind <gwynne@vapor.codes>
1 parent bd1b78a commit b279723

File tree

3 files changed

+117
-117
lines changed

3 files changed

+117
-117
lines changed

Package.resolved

Lines changed: 92 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.6
22
/*
33
This source file is part of the Swift.org open source project
44

@@ -42,17 +42,17 @@ let package = Package(
4242
name: "SwiftDocC",
4343
dependencies: [
4444
.product(name: "Markdown", package: "swift-markdown"),
45-
"SymbolKit",
46-
"CLMDB",
45+
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
46+
.product(name: "CLMDB", package: "swift-lmdb"),
4747
.product(name: "Crypto", package: "swift-crypto"),
4848
],
4949
swiftSettings: swiftSettings
5050
),
5151
.testTarget(
5252
name: "SwiftDocCTests",
5353
dependencies: [
54-
"SwiftDocC",
55-
"SwiftDocCTestUtilities",
54+
.target(name: "SwiftDocC"),
55+
.target(name: "SwiftDocCTestUtilities"),
5656
],
5757
resources: [
5858
.copy("Test Resources"),
@@ -67,7 +67,7 @@ let package = Package(
6767
.target(
6868
name: "SwiftDocCUtilities",
6969
dependencies: [
70-
"SwiftDocC",
70+
.target(name: "SwiftDocC"),
7171
.product(name: "NIOHTTP1", package: "swift-nio"),
7272
.product(name: "ArgumentParser", package: "swift-argument-parser")
7373
],
@@ -76,9 +76,9 @@ let package = Package(
7676
.testTarget(
7777
name: "SwiftDocCUtilitiesTests",
7878
dependencies: [
79-
"SwiftDocCUtilities",
80-
"SwiftDocC",
81-
"SwiftDocCTestUtilities",
79+
.target(name: "SwiftDocCUtilities"),
80+
.target(name: "SwiftDocC"),
81+
.target(name: "SwiftDocCTestUtilities"),
8282
],
8383
resources: [
8484
.copy("Test Resources"),
@@ -90,7 +90,7 @@ let package = Package(
9090
.target(
9191
name: "SwiftDocCTestUtilities",
9292
dependencies: [
93-
"SymbolKit"
93+
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
9494
],
9595
swiftSettings: swiftSettings
9696
),
@@ -99,7 +99,7 @@ let package = Package(
9999
.executableTarget(
100100
name: "docc",
101101
dependencies: [
102-
"SwiftDocCUtilities",
102+
.target(name: "SwiftDocCUtilities"),
103103
],
104104
swiftSettings: swiftSettings
105105
),
@@ -108,7 +108,7 @@ let package = Package(
108108
.executableTarget(
109109
name: "signal-test-app",
110110
dependencies: [
111-
"SwiftDocCUtilities",
111+
.target(name: "SwiftDocCUtilities"),
112112
],
113113
path: "Tests/signal-test-app",
114114
swiftSettings: swiftSettings
@@ -117,8 +117,8 @@ let package = Package(
117117
.executableTarget(
118118
name: "generate-symbol-graph",
119119
dependencies: [
120-
"SwiftDocC",
121-
"SymbolKit",
120+
.target(name: "SwiftDocC"),
121+
.product(name: "SymbolKit", package: "swift-docc-symbolkit"),
122122
],
123123
swiftSettings: swiftSettings
124124
),
@@ -132,28 +132,22 @@ let package = Package(
132132
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
133133
// Building standalone, so fetch all dependencies remotely.
134134
package.dependencies += [
135-
.package(url: "https://github.com/apple/swift-nio.git", .upToNextMinor(from: "2.31.2")),
136-
.package(name: "swift-markdown", url: "https://github.com/apple/swift-markdown.git", .branch("main")),
137-
.package(name: "CLMDB", url: "https://github.com/apple/swift-lmdb.git", .branch("main")),
138-
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.0.1")),
139-
.package(name: "SymbolKit", url: "https://github.com/apple/swift-docc-symbolkit", .branch("main")),
140-
.package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "1.1.2")),
141-
]
142-
143-
// SwiftPM command plugins are only supported by Swift version 5.6 and later.
144-
#if swift(>=5.6)
145-
package.dependencies += [
135+
.package(url: "https://github.com/apple/swift-nio.git", from: "2.53.0"),
136+
.package(url: "https://github.com/apple/swift-markdown.git", branch: "main"),
137+
.package(url: "https://github.com/apple/swift-lmdb.git", branch: "main"),
138+
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
139+
.package(url: "https://github.com/apple/swift-docc-symbolkit", branch: "main"),
140+
.package(url: "https://github.com/apple/swift-crypto.git", from: "2.5.0"),
146141
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
147142
]
148-
#endif
149143
} else {
150144
// Building in the Swift.org CI system, so rely on local versions of dependencies.
151145
package.dependencies += [
152146
.package(path: "../swift-nio"),
153147
.package(path: "../swift-markdown"),
154-
.package(name: "CLMDB", path: "../swift-lmdb"),
148+
.package(path: "../swift-lmdb"),
155149
.package(path: "../swift-argument-parser"),
156-
.package(name: "SymbolKit", path: "../swift-docc-symbolkit"),
150+
.package(path: "../swift-docc-symbolkit"),
157151
.package(path: "../swift-crypto"),
158152
]
159153
}

Sources/SwiftDocC/Utility/LMDB/LMDB.swift

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,19 +81,11 @@ extension Data: LMDBData {
8181
self = Data.init(bytes: data.baseAddress!, count: data.count)
8282
}
8383

84-
#if swift(>=5.0)
8584
public func read<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R{
8685
return try self.withUnsafeBytes({ (ptr) -> R in
8786
return try body(ptr)
8887
})
8988
}
90-
#else
91-
public func read<R>(_ body: (UnsafeRawBufferPointer) throws -> R) rethrows -> R{
92-
return try self.withUnsafeBytes({ (ptr) -> R in
93-
return try body(UnsafeRawBufferPointer(start: ptr, count: self.count))
94-
})
95-
}
96-
#endif
9789
}
9890

9991
extension String: LMDBData {
@@ -106,10 +98,10 @@ extension String: LMDBData {
10698
}
10799
}
108100

109-
#if !os(Linux) && !os(Android)
110-
// This is required for macOS and Swift 4.2, for Linux the default implementation works as expected.
101+
// This is required for macOS, for Linux the default implementation works as expected.
111102
extension Array: LMDBData where Element: FixedWidthInteger {
112103

104+
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
113105
public init?(data: UnsafeRawBufferPointer) {
114106
var array = Array<Element>(repeating: 0, count: data.count / MemoryLayout<Element>.stride)
115107
_ = array.withUnsafeMutableBytes { data.copyBytes(to: $0) }
@@ -120,11 +112,9 @@ extension Array: LMDBData where Element: FixedWidthInteger {
120112
let data = self.withUnsafeBufferPointer { Data(buffer: $0) }
121113
return try data.read(body)
122114
}
115+
#endif
123116

124117
}
125-
#else
126-
extension Array: LMDBData where Element: FixedWidthInteger {}
127-
#endif
128118

129119
extension Bool: LMDBData {}
130120
extension Int: LMDBData {}

0 commit comments

Comments
 (0)