forked from mongodb/mongo-swift-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
52 lines (49 loc) · 2.3 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
// swift-tools-version:5.1
/// To avoid breaking Swift 5.1 compatibility, only require newer NIO versions when we need NIO's concurrency APIs.
func getMinNIOVersion() -> PackageDescription.Package.Dependency.Requirement {
#if compiler(>=5.5.2) && canImport(_Concurrency)
return .upToNextMajor(from: "2.36.0")
#else
return .upToNextMajor(from: "2.15.0")
#endif
}
import PackageDescription
let package = Package(
name: "mongo-swift-driver",
platforms: [
.macOS(.v10_14)
],
products: [
.library(name: "MongoSwift", targets: ["MongoSwift"]),
.library(name: "MongoSwiftSync", targets: ["MongoSwiftSync"])
],
dependencies: [
.package(url: "https://github.com/Quick/Nimble.git", .upToNextMajor(from: "8.0.0")),
.package(url: "https://github.com/apple/swift-nio", getMinNIOVersion()),
.package(url: "https://github.com/mongodb/swift-bson", .upToNextMajor(from: "3.0.0"))
],
targets: [
.target(name: "MongoSwiftSync", dependencies: ["MongoSwift", "NIO"]),
.target(name: "AtlasConnectivity", dependencies: ["MongoSwiftSync"]),
.target(name: "TestsCommon", dependencies: ["MongoSwift", "Nimble"]),
.testTarget(name: "BSONTests", dependencies: ["MongoSwift", "TestsCommon", "Nimble", "CLibMongoC"]),
.testTarget(name: "MongoSwiftTests", dependencies: ["MongoSwift", "TestsCommon", "Nimble", "NIO", "NIOConcurrencyHelpers"]),
.testTarget(name: "MongoSwiftSyncTests", dependencies: ["MongoSwiftSync", "TestsCommon", "Nimble", "MongoSwift"]),
.target(
name: "CLibMongoC",
dependencies: [],
linkerSettings: [
.linkedLibrary("resolv"),
.linkedLibrary("ssl", .when(platforms: [.linux])),
.linkedLibrary("crypto", .when(platforms: [.linux])),
.linkedLibrary("z", .when(platforms: [.linux]))
]
)
]
)
#if compiler(>=5.3)
package.dependencies += [.package(url: "https://github.com/apple/swift-atomics", .upToNextMajor(from: "1.0.0"))]
package.targets += [.target(name: "MongoSwift", dependencies: ["Atomics", "CLibMongoC", "NIO", "NIOConcurrencyHelpers", "SwiftBSON"])]
#else
package.targets += [.target(name: "MongoSwift", dependencies: ["CLibMongoC", "NIO", "NIOConcurrencyHelpers", "SwiftBSON"])]
#endif