-
Notifications
You must be signed in to change notification settings - Fork 2
/
Package.swift
80 lines (71 loc) · 2.59 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
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.
import class Foundation.ProcessInfo
import PackageDescription
let externalDependencies: [String: Range<Version>] = [
"https://github.com/apple/swift-argument-parser": .upToNextMajor(from: "1.0.0"),
"https://github.com/apple/swift-system": .upToNextMajor(from: "1.0.0"),
"https://github.com/apple/swift-docc-plugin": .upToNextMajor(from: "1.0.0")
]
let internalDependencies: [String: Range<Version>] = [
"package-concurrency-helpers": .upToNextMajor(from: "2.0.0"),
"package-datetime": .upToNextMajor(from: "1.0.1"),
]
func makeDependencies() -> [Package.Dependency] {
var dependencies: [Package.Dependency] = []
dependencies.reserveCapacity(externalDependencies.count + internalDependencies.count)
for extDep in externalDependencies {
dependencies.append(.package(url: extDep.key, extDep.value))
}
let localPath = ProcessInfo.processInfo.environment["LOCAL_PACKAGES_DIR"]
for intDep in internalDependencies {
if let localPath {
dependencies.append(.package(name: "\(intDep.key)", path: "\(localPath)/\(intDep.key)"))
} else {
dependencies.append(.package(url: "https://github.com/ordo-one/\(intDep.key)", intDep.value))
}
}
return dependencies
}
let package = Package(
name: "package-frostflake",
platforms: [
.macOS(.v13),
.iOS(.v16),
],
products: [
.library(
name: "Frostflake",
targets: ["Frostflake"]
),
.executable(
name: "flake",
targets: ["FrostflakeUtility"]
),
],
dependencies: makeDependencies(),
targets: [
// Main library target
.target(name: "Frostflake",
dependencies: [
.product(name: "PackageConcurrencyHelpers", package: "package-concurrency-helpers"),
.product(name: "DateTime", package: "package-datetime"),
],
path: "Sources/Frostflake"),
// Command line Frostflake generator
.executableTarget(
name: "FrostflakeUtility",
dependencies: [
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "SystemPackage", package: "swift-system"),
"Frostflake",
]
),
.testTarget(
name: "FrostflakeTests",
dependencies: [
"FrostflakeUtility", "Frostflake"
]
)
]
)