|
1 | 1 | // swift-tools-version: 5.7 |
2 | | - |
3 | 2 | import PackageDescription |
4 | 3 |
|
5 | | -let package = Package( |
6 | | - name: "danthorpe-networking", |
7 | | - platforms: [ |
8 | | - .macOS(.v12), |
9 | | - .iOS(.v15), |
10 | | - .tvOS(.v15), |
11 | | - .watchOS(.v8) |
12 | | - ], |
13 | | - products: [ |
14 | | - .library(name: "Networking", targets: ["Networking"]), |
15 | | - ], |
16 | | - dependencies: [ |
17 | | - .package(url: "https://github.com/pointfreeco/swift-tagged", from: "0.7.0"), |
18 | | - .package(url: "https://github.com/pointfreeco/swift-url-routing", branch: "main"), |
19 | | - .package(url: "https://github.com/danthorpe/danthorpe-utilities", branch: "main"), |
20 | | - .package(url: "https://github.com/danthorpe/danthorpe-plugins", branch: "main"), |
21 | | - ], |
22 | | - targets: [ |
23 | | - .target( |
24 | | - name: "Networking", |
25 | | - dependencies: [ |
26 | | - .product(name: "Cache", package: "danthorpe-utilities"), |
27 | | - .product(name: "ShortID", package: "danthorpe-utilities"), |
28 | | - .product(name: "Tagged", package: "swift-tagged"), |
29 | | - .product(name: "URLRouting", package: "swift-url-routing") |
30 | | - ], |
31 | | - plugins: [ |
32 | | - .plugin(name: "SwiftLintPlugin", package: "danthorpe-plugins") |
33 | | - ] |
34 | | - ), |
35 | | - .testTarget(name: "NetworkingTests", dependencies: ["Networking"]), |
36 | | - ] |
37 | | -) |
| 4 | +var package = Package(name: "danthorpe-networking") |
| 5 | + |
| 6 | +// MARK: - Platforms |
| 7 | + |
| 8 | +package.platforms = [ |
| 9 | + .macOS(.v12), |
| 10 | + .iOS(.v14), |
| 11 | + .tvOS(.v14), |
| 12 | + .watchOS(.v7) |
| 13 | +] |
| 14 | + |
| 15 | +package.dependencies = [ |
| 16 | + .package(url: "https://github.com/pointfreeco/swift-tagged", from: "0.7.0"), |
| 17 | + .package(url: "https://github.com/pointfreeco/swift-url-routing", branch: "main"), |
| 18 | + .package(url: "https://github.com/danthorpe/danthorpe-utilities", from: "0.2.0"), |
| 19 | + .package(url: "https://github.com/danthorpe/danthorpe-plugins", from: "0.2.0"), |
| 20 | +] |
| 21 | + |
| 22 | +// MARK: - Names |
| 23 | + |
| 24 | +let Networking = "Networking" |
| 25 | + |
| 26 | +extension String { |
| 27 | + var tests: String { "\(self)Tests" } |
| 28 | +} |
| 29 | + |
| 30 | +// MARK: - Products |
| 31 | + |
| 32 | +package.products = [ |
| 33 | + .library(name: Networking, targets: [Networking]) |
| 34 | +] |
| 35 | + |
| 36 | +// MARK: Targets |
| 37 | + |
| 38 | +extension Target { |
| 39 | + static let networking: Target = .target( |
| 40 | + name: Networking, |
| 41 | + dependencies: [ |
| 42 | + .cache, .shortID, .tagged, .URLRouting |
| 43 | + ], |
| 44 | + plugins: [ |
| 45 | + .swiftLint |
| 46 | + ] |
| 47 | + ) |
| 48 | + static let networkingTests: Target = .testTarget( |
| 49 | + name: Networking.tests, |
| 50 | + dependencies: [ |
| 51 | + .networking |
| 52 | + ] |
| 53 | + ) |
| 54 | +} |
| 55 | + |
| 56 | +package.targets = [ |
| 57 | + .networking, |
| 58 | + .networkingTests |
| 59 | +] |
| 60 | + |
| 61 | +// MARK: - Dependencies |
| 62 | + |
| 63 | +extension Target.Dependency { |
| 64 | + static let networking: Target.Dependency = .target( |
| 65 | + name: Networking |
| 66 | + ) |
| 67 | + static let cache: Target.Dependency = .product( |
| 68 | + name: "Cache", package: "danthorpe-utilities" |
| 69 | + ) |
| 70 | + static let shortID: Target.Dependency = .product( |
| 71 | + name: "ShortID", package: "danthorpe-utilities" |
| 72 | + ) |
| 73 | + static let tagged: Target.Dependency = .product( |
| 74 | + name: "Tagged", package: "swift-tagged" |
| 75 | + ) |
| 76 | + static let URLRouting: Target.Dependency = .product( |
| 77 | + name: "URLRouting", package: "swift-url-routing" |
| 78 | + ) |
| 79 | +} |
| 80 | + |
| 81 | +// MARK: - Plugins |
| 82 | + |
| 83 | +extension Target.PluginUsage { |
| 84 | + static let swiftLint: Target.PluginUsage = .plugin( |
| 85 | + name: "SwiftLint", package: "danthorpe-plugins" |
| 86 | + ) |
| 87 | +} |
0 commit comments