forked from SwifQL/PostgresBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
58 lines (46 loc) · 1.75 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
// swift-tools-version:5.2
import PackageDescription
import Foundation
// MARK: - Conveniences
let localDev = ProcessInfo.processInfo.environment["LIBS_DEVELOPMENT"] == "1"
let devDir = "../"
struct Dep {
let package: PackageDescription.Package.Dependency
let targets: [Target.Dependency]
}
extension Array where Element == Dep {
mutating func appendLocal(_ path: String, targets: Target.Dependency...) {
append(.init(package: .package(path: "\(devDir)\(path)"), targets: targets))
}
mutating func append(_ url: String, from: Version, targets: Target.Dependency...) {
append(.init(package: .package(url: url, from: from), targets: targets))
}
mutating func append(_ url: String, _ requirement: PackageDescription.Package.Dependency.Requirement, targets: Target.Dependency...) {
append(.init(package: .package(url: url, requirement), targets: targets))
}
}
// MARK: - Dependencies
var deps: [Dep] = []
deps.append("https://github.com/vapor/postgres-nio.git", from: "1.0.0", targets: .product(name: "PostgresNIO", package: "postgres-nio"))
if localDev {
deps.appendLocal("Bridges", targets: "Bridges")
} else {
deps.append("https://github.com/SwifQL/Bridges.git", from: "1.0.0-rc", targets: .product(name: "Bridges", package: "Bridges"))
}
// MARK: - Package
let package = Package(
name: "PostgresBridge",
platforms: [
.macOS(.v10_15)
],
products: [
.library(name: "PostgresBridge", targets: ["PostgresBridge"]),
],
dependencies: deps.map { $0.package },
targets: [
.target(name: "PostgresBridge", dependencies: deps.flatMap { $0.targets }),
.testTarget(name: "PostgresBridgeTests", dependencies: [
.target(name: "PostgresBridge")
]),
]
)