-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPackage.swift
108 lines (96 loc) · 3.06 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
// swift-tools-version: 5.9
import PackageDescription
// MARK: - Convenience
let allModules: [String] = [
.kippleColors,
.kippleFonts,
.kippleHaptics,
.kippleShaders,
.kippleShapes,
]
let allModulesAsProducts = allModules.map { Product.library(name: $0, targets: [$0]) }
let allModulesAsDependencies = allModules.map(Target.Dependency.init)
// MARK: - Package Definition
let package = Package(
name: "KippleUI",
platforms: [
.iOS(.v17),
.macOS(.v14),
.tvOS(.v17),
.watchOS(.v10),
],
products: [.library(name: .kippleUI, targets: [.kippleUI])] + allModulesAsProducts,
dependencies: [
.package(url: "https://github.com/bdrelling/Kipple", revision: "7b64f96fa67d68b35722029f2ef02a417a911b62"), // .upToNextMinor(from: "0.14.2")),
.package(url: "https://github.com/bdrelling/KippleTools", .upToNextMinor(from: "0.5.3")),
],
targets: [
// Product Targets (without Dependencies)
.kippleTarget(name: .kippleColors),
.kippleTarget(name: .kippleFonts),
.kippleTarget(name: .kippleHaptics),
// Product Targets (with Dependencies)
.kippleTarget(
name: .kippleUI,
dependencies: [
.product(name: "KippleFoundation", package: "Kipple"),
] + allModulesAsDependencies
),
.kippleTarget(
name: .kippleShaders,
resources: [
.process("Shaders"),
]
),
.kippleTarget(
name: .kippleShapes,
dependencies: [
.target(name: .kippleColors),
]
),
// Test Targets
.kippleTestTarget(name: .kippleColors),
.kippleTestTarget(
name: .kippleFonts,
resources: [
.process("Resources"),
]
),
.kippleTestTarget(name: .kippleShaders),
]
)
// MARK: - Extensions
extension Target {
static func kippleTarget(name: String, dependencies: [Target.Dependency] = [], resources: [Resource]? = nil) -> Target {
.target(
name: name,
dependencies: dependencies,
resources: resources,
cSettings: [
.define("PLATFORM_WATCH_OS", .when(platforms: [.watchOS])),
],
swiftSettings: [
.define("PLATFORM_WATCH_OS", .when(platforms: [.watchOS])),
]
)
}
static func kippleTestTarget(name: String, resources: [Resource]? = nil) -> Target {
.testTarget(
name: "\(name)Tests",
dependencies: [
.target(name: name),
],
resources: resources
)
}
}
// MARK: - Constants
/// Defined `String` constants representing each of our modules
extension String {
static let kippleUI = "KippleUI"
static let kippleColors = "KippleColors"
static let kippleFonts = "KippleFonts"
static let kippleHaptics = "KippleHaptics"
static let kippleShaders = "KippleShaders"
static let kippleShapes = "KippleShapes"
}