-
Notifications
You must be signed in to change notification settings - Fork 0
/
Package.swift
58 lines (46 loc) · 1.77 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/mysql-nio.git", from: "1.0.0-rc", targets: .product(name: "MySQLNIO", package: "mysql-nio"))
if localDev {
deps.appendLocal("Bridges", targets: .product(name: "Bridges", package: "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: "MySQLBridge",
platforms: [
.macOS(.v10_15)
],
products: [
.library(name: "MySQLBridge", targets: ["MySQLBridge"]),
],
dependencies: deps.map { $0.package },
targets: [
.target(name: "MySQLBridge", dependencies: deps.flatMap { $0.targets }),
.testTarget(name: "MySQLBridgeTests", dependencies: [
.target(name: "MySQLBridge")
]),
]
)