-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Package.swift
103 lines (92 loc) · 3.63 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
// swift-tools-version: 5.10
import PackageDescription
var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/tayloraswift/swift-png.git", from: "4.4.4"),
.package(url: "https://github.com/tayloraswift/jpeg.git", from: "1.1.0"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.17.4"),
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.2.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),
.package(url: "https://github.com/realm/SwiftLint.git", from: "0.56.2")
]
#if os(macOS)
// https://forums.swift.org/t/swiftlint-on-linux/64256
let plugins: [Target.PluginUsage]? = [.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint")]
#else
let plugins: [Target.PluginUsage]? = nil
#endif
let package = Package(
name: "swift-geometrize",
platforms: [
.macOS("13.3"), .iOS(.v14)
],
products: [
.library(
name: "Geometrize",
targets: ["Geometrize"]
),
.library(
name: "BitmapImportExport",
targets: ["BitmapImportExport"]
),
.executable(
name: "geometrize",
targets: ["geometrize-cli"]
)
],
dependencies: dependencies,
targets: [
.target(
name: "Geometrize",
dependencies: [
.product(name: "Algorithms", package: "swift-algorithms")
],
path: "Sources/geometrize",
resources: [.copy("PrivacyInfo.xcprivacy")],
plugins: plugins
),
.target(
name: "BitmapImportExport",
dependencies: [
"Geometrize",
.product(name: "PNG", package: "swift-png"),
.product(name: "JPEG", package: "jpeg", moduleAliases: ["JPEG": "SwiftJPEG"])
],
path: "Sources/bitmapImportExport",
resources: [.copy("PrivacyInfo.xcprivacy")],
plugins: plugins
),
.executableTarget(
name: "geometrize-cli",
dependencies: [
"Geometrize",
"BitmapImportExport",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "PNG", package: "swift-png"),
.product(name: "JPEG", package: "jpeg", moduleAliases: ["JPEG": "SwiftJPEG"])
// alias solves build error
// error: multiple products named 'unit-test' in: 'jpeg' (at '****/jpeg'), 'swift-png' (from 'https://github.com/tayloraswift/swift-png.git')
// https://github.com/tayloraswift/jpeg/issues/4
// https://forums.swift.org/t/product-names-from-different-packages-collide-if-packages-are-used-as-dependencies-in-same-package/60178
// Uses Swift 5.7 feature https://github.com/apple/swift-evolution/blob/main/proposals/0339-module-aliasing-for-disambiguation.md
],
path: "Sources/geometrize-cli",
resources: [.copy("PrivacyInfo.xcprivacy")],
plugins: plugins
),
.testTarget(
name: "geometrizeTests",
dependencies: [
"Geometrize",
"BitmapImportExport",
.product(name: "PNG", package: "swift-png"),
.product(name: "SnapshotTesting", package: "swift-snapshot-testing")
],
path: "Tests/geometrizeTests",
resources: [
.copy("Resources"),
.copy("__Snapshots__")
],
plugins: plugins
)
]
)