-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPackage.swift
67 lines (57 loc) · 1.66 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
// swift-tools-version: 6.0
import Foundation // for String.capitalized
import PackageDescription
let name = "Thrappture"
_ = Package(
name: name,
platforms: [.iOS(.v13), .macOS(.v10_15)],
products: [.library(name: name, targets: [name])],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-docc-plugin", branch: "main")
],
targets: [
.target(name: name),
.testTarget(
name: name + ".Tests",
dependencies: [.init(stringLiteral: name)]
)
]
)
// MARK: - Dependency
nonisolated var dependencies: [Dependency] {
[ .swift(repositoryName: "docc-plugin")
]
}
struct Dependency {
let package: Package.Dependency
let product: Target.Dependency
}
extension Dependency {
static func apple(repositoryName: String) -> Self {
.swift(organization: "apple", repositoryName: repositoryName)
}
static func swift(organization: String = "swiftlang", repositoryName: String) -> Self {
.init(
organization: organization,
name: repositoryName.split(separator: "-").map(\.capitalized).joined(),
repositoryName: "swift-\(repositoryName)"
)
}
static func catterwaul(name: String, repositoryName: String? = nil, branch: String? = nil) -> Self {
.init(
organization: "Catterwaul",
name: name,
repositoryName: repositoryName ?? name,
branch: branch
)
}
private init(organization: String, name: String, repositoryName: String, branch: String? = nil) {
self.init(
package: .package(
url: "https://github.com/\(organization)/\(repositoryName)",
branch: branch ?? "main"
),
product: .product(name: name, package: repositoryName)
)
}
}