-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
54 lines (44 loc) · 1.29 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
// swift-tools-version: 5.6
import PackageDescription
// Add your modules here
let modules = [
"Stdlib",
"Foundation",
]
let package = Package(
name: "SwifterSwift",
platforms: [
.iOS(.v10),
.macOS(.v10_10),
.tvOS(.v9),
.watchOS(.v2),
],
products: products(modules),
targets: targets(modules)
)
// MARK: - Private Helpers
private func products(_ modules: [String]) -> [Product] {
let main = Product.library(name: "SwifterSwift", targets: ["SwifterSwift"])
return [main] + modules.map(library(module:))
}
func library(module: String) -> Product {
.library(name: "Swifter\(module)", targets: ["Swifter\(module)"])
}
func targets(_ modules: [String]) -> [Target] {
let main = Target.target(
name: "SwifterSwift",
dependencies: modules.map { .init(stringLiteral: "Swifter\($0)") },
path: "Sources/SwifterSwift"
)
return [main] + modules.map(target) + modules.map(testTarget)
}
func target(module: String) -> Target {
return Target.target(name: "Swifter\(module)", path: "Sources/\(module)")
}
func testTarget(module: String) -> Target {
return Target.testTarget(
name: "\(module)Tests",
dependencies: [.init(stringLiteral: "Swifter\(module)")],
path: "Tests/\(module)"
)
}