-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
74 lines (66 loc) · 1.87 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
// swift-tools-version:5.10.1
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
extension String {
static let css: Self = "CSS"
}
extension Target.Dependency {
static var css: Self { .target(name: .css) }
}
extension Target.Dependency {
static var dependencies: Self { .product(name: "Dependencies", package: "swift-dependencies") }
}
extension [Package.Dependency] {
static var `default`: Self {
[
.package(url: "https://github.com/pointfreeco/swift-dependencies.git", from: "1.3.5"),
]
}
}
struct CustomTarget {
let name: String
var library: Bool = true
var dependencies: [Target.Dependency] = []
}
extension Package {
static func html(
targets: [CustomTarget]
) -> Package {
return Package(
name: "swift-css",
platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)],
products: [
[
.library(name: .css, targets: [.css]),
]
].flatMap { $0
},
dependencies: .default,
targets: [
targets.map { target in
Target.target(
name: "\(target.name)",
dependencies: [] + target.dependencies
)
},
targets.map { target in
Target.testTarget(
name: "\(target.name) Tests",
dependencies: [.init(stringLiteral: target.name)]
)
}
].flatMap { $0 }
)
}
}
let package = Package.html(
targets: [
.init(
name: .css,
library: true,
dependencies: [
.dependencies
]
),
]
)