-
Notifications
You must be signed in to change notification settings - Fork 2
/
Package.swift
166 lines (153 loc) · 5.37 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
// MARK: - Setup
private let environment: Environment = .production
let package = Package(
name: "Maas",
platforms: [
.iOS(.v13),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Maas",
targets: ["Maas", "Examples"]),
] + environment.products,
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(
name: "Swappable",
url: "https://github.com/trafi/swappable.git", .upToNextMinor(from: "0.0.1")),
.package(
name: "SnapshotTesting",
url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.8.2"),
.package(
name: "Quick",
url: "https://github.com/Quick/Quick.git", from: "3.0.0"),
.package(
name: "swift-composable-architecture",
url: "https://github.com/pointfreeco/swift-composable-architecture", from: "0.10.0"),
] + environment.dependencies,
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Maas",
dependencies: ["Swappable"],
path: "ios/Sources/Maas",
exclude: ["ios/Sources/Maas/README.md"]
),
.target(
name: "Examples",
dependencies: [
"MaasCore",
"MaasRouteSearch",
"MaasNearbyTransit",
"MaasAccount",
],
path: "ios/Sources/Examples"
),
.testTarget(
name: "MaasTests",
dependencies: [
"Maas",
"MaasRouteSearch",
"MaasNearbyTransit",
"MaasAccount",
"SnapshotTesting",
"Quick",
.product(name: "ComposableArchitecture", package: "swift-composable-architecture")
],
path: "ios/Tests/MaasTests",
exclude: ["__Snapshots__"]),
] + environment.targets
)
// MARK: - Environment
private enum Environment {
case development, production
}
private extension Environment {
var products: [Product] {
switch self {
case .development:
return [
// --
]
case .production:
return [
.library(
name: "MaasCore",
targets: ["CoreBinary", "MaasCore"]),
.library(
name: "MaasTheme",
targets: ["MaasTheme"]),
.library(
name: "MaasComponents",
targets: ["MaasComponents"]),
.library(
name: "MaasRouteSearch",
targets: ["MaasRouteSearch"]),
.library(
name: "MaasNearbyTransit",
targets: ["MaasNearbyTransit"]),
.library(
name: "MaasAccount",
targets: ["MaasAccount"]),
]
}
}
var targets: [Target] {
switch self {
case .development:
return [
// --
]
case .production:
return [
.binaryTarget(
name: "CoreBinary",
url: "https://github.com/trafi/maas-components/releases/download/0.1.0-dev03/CoreBinary.xcframework.zip",
checksum: "c8b376464436b341bd70847d70f7c4605b381006da33db495d40716323673b55"),
.maasCoreTarget(name: "MaasCore", dependencies: [.product(name: "ComposableArchitecture", package: "swift-composable-architecture")]),
.maasCoreTarget(name: "MaasTheme"),
.maasCoreTarget(name: "MaasComponents", dependencies: ["MaasTheme", "MaasCore", "Swappable"]),
.maasTarget(name: "MaasRouteSearch"),
.maasTarget(name: "MaasNearbyTransit"),
.maasTarget(name: "MaasAccount"),
]
}
}
var dependencies: [Package.Dependency] {
switch self {
case .development:
return [
.package(path: "ios/MaasCore"),
.package(path: "ios/MaasRouteSearch"),
.package(path: "ios/MaasNearbyTransit"),
.package(path: "ios/MaasAccount"),
]
case .production:
return [
// --
]
}
}
}
private extension Target {
static func maasTarget(name: String) -> Target {
.target(
name: name,
dependencies: ["MaasCore", "MaasTheme", "MaasComponents", "Swappable"],
path: "ios/\(name)/Sources",
exclude: ["Package.resolved"]
)
}
static func maasCoreTarget(name: String, dependencies: [Target.Dependency] = []) -> Target {
.target(
name: name,
dependencies: dependencies + ["CoreBinary"],
path: "ios/MaasCore/Sources/\(name)"
)
}
}