@@ -7,77 +7,151 @@ var package = Package(name: "danthorpe-utilities")
77
88package . platforms = [
99 . macOS( . v12) ,
10- . iOS( . v15 ) ,
11- . tvOS( . v15 ) ,
12- . watchOS( . v8 )
10+ . iOS( . v14 ) ,
11+ . tvOS( . v14 ) ,
12+ . watchOS( . v7 )
1313]
1414
15- // MARK: - Products
16-
17- package . products = [
18- . library( name: " Cache " , targets: [ " Cache " ] ) ,
19- . library( name: " EnvironmentProviders " , targets: [ " EnvironmentProviders " ] ) ,
20- . library( name: " FileManagerClient " , targets: [ " FileManagerClient " ] ) ,
21- . library( name: " Reachability " , targets: [ " ReachabilityLive " ] ) ,
22- . library( name: " ReachabilityMocks " , targets: [ " ReachabilityMocks " ] ) ,
23- . library( name: " ShortID " , targets: [ " ShortID " ] ) ,
24- . library( name: " Utilities " , targets: [ " Cache " , " ReachabilityLive " , " ShortID " ] ) ,
25- ]
26-
27- // MARK: - Dependencies
15+ // MARK: - External Dependencies
2816
2917package . dependencies = [
3018 . package ( url: " https://github.com/apple/swift-argument-parser.git " , branch: " main " ) ,
31- . package ( url: " https://github.com/apple/swift-async-algorithms " , branch: " main " ) ,
3219 . package ( url: " https://github.com/apple/swift-collections " , from: " 1.0.2 " ) ,
33- . package ( url: " https://github.com/pointfreeco/xctest-dynamic-overlay " , from: " 0.2.1 " ) ,
34- . package ( url: " https://github.com/danthorpe/danthorpe-plugins " , branch: " main " ) ,
20+ . package ( url: " https://github.com/danthorpe/danthorpe-plugins " , from: " 0.2.0 " ) ,
21+ . package ( url: " https://github.com/pointfreeco/swift-composable-architecture " , from: " 0.44.0 " ) ,
22+ . package ( url: " https://github.com/pointfreeco/xctest-dynamic-overlay " , from: " 0.5.0 " ) ,
3523]
3624
37- // MARK: - Targets
38-
39- var targets : [ Target ] = [
40-
41- . target(
42- name: " Cache " ,
43- dependencies: [
44- " Extensions " ,
45- " EnvironmentProviders " ,
46- . product( name: " AsyncAlgorithms " , package : " swift-async-algorithms " ) ,
47- . product( name: " OrderedCollections " , package : " swift-collections " ) ,
48- . product( name: " DequeModule " , package : " swift-collections " ) ,
49- ]
50- ) ,
51-
52- . target( name: " Extensions " ) ,
53-
54- . target( name: " EnvironmentProviders " ) ,
55-
56- . target( name: " FileManagerClient " , dependencies: [
57- . product( name: " XCTestDynamicOverlay " , package : " xctest-dynamic-overlay " )
58- ] ) ,
25+ // MARK: - Name
26+ let Cache = " Cache "
27+ let EnvironmentProviders = " EnvironmentProviders "
28+ let Extensions = " Extensions "
29+ let FileManagerClient = " FileManagerClient "
30+ let Protected = " Protected "
31+ let Reachability = " Reachability "
32+ let ShortID = " ShortID "
33+ let Utilities = " Utilities "
34+
35+ private extension String {
36+ var tests : String { " \( self ) Tests " }
37+ var mocks : String { " \( self ) Mocks " }
38+ var live : String { " \( self ) Live " }
39+ }
5940
60- . target( name: " Reachability " ) ,
61- . target( name: " ReachabilityLive " , dependencies: [ " Reachability " ] ) ,
62- . target( name: " ReachabilityMocks " , dependencies: [ " Reachability " ] ) ,
41+ // MARK: - Products
6342
64- . target( name: " ShortID " , dependencies: [ " Concurrency " ] ) ,
43+ package . products = [
44+ . library( name: Cache, targets: [ Cache] ) ,
45+ . library( name: EnvironmentProviders, targets: [ EnvironmentProviders] ) ,
46+ . library( name: FileManagerClient, targets: [ FileManagerClient] ) ,
47+ . library( name: Protected, targets: [ Protected] ) ,
48+ . library( name: Reachability, targets: [ Reachability] ) ,
49+ . library( name: ShortID, targets: [ ShortID] ) ,
50+ ]
6551
66- . target ( name : " Concurrency " , dependencies : [ ] ) ,
52+ // MARK: - Targets
6753
68- . testTarget( name: " CacheTests " , dependencies: [ " Cache " ] ) ,
69- . testTarget( name: " ConcurrencyTests " , dependencies: [ " Concurrency " ] ) ,
70- . testTarget( name: " ShortIDTests " , dependencies: [ " ShortID " ] ) ,
71- ]
54+ extension Target {
55+ static let cache : Target = . target(
56+ name: Cache,
57+ dependencies: [
58+ . extensions,
59+ . environmentProviders,
60+ . orderedCollection,
61+ . deque
62+ ]
63+ )
64+ static let cacheTests : Target = . testTarget(
65+ name: Cache . tests,
66+ dependencies: [ . cache ]
67+ )
68+ static let protected : Target = . target(
69+ name: Protected
70+ )
71+ static let protectedTests : Target = . testTarget(
72+ name: Protected . tests,
73+ dependencies: [ . protected ]
74+ )
75+ static let extensions : Target = . target(
76+ name: Extensions
77+ )
78+ static let environmentProviders : Target = . target(
79+ name: EnvironmentProviders
80+ )
81+ static let fileManagerClient : Target = . target(
82+ name: FileManagerClient,
83+ dependencies: [ . xctestDynamicOverlay ]
84+ )
85+ static let reachability : Target = . target(
86+ name: Reachability,
87+ dependencies: [ . dependencies, . xctestDynamicOverlay ]
88+ )
89+ static let shortID : Target = . target(
90+ name: ShortID,
91+ dependencies: [ . dependencies, . protected ]
92+ )
93+ static let shortIDTests : Target = . testTarget(
94+ name: ShortID . tests,
95+ dependencies: [ . shortID ]
96+ )
97+ }
7298
73- // Set SwiftLint plugin
74- targets = targets. update ( . regular, . test, plugins: [
75- . plugin( name: " SwiftLintPlugin " , package : " danthorpe-plugins " ) ,
99+ package . targets = [
100+ . cache,
101+ . cacheTests,
102+ . protected,
103+ . protectedTests,
104+ . extensions,
105+ . environmentProviders,
106+ . fileManagerClient,
107+ . reachability,
108+ . shortID,
109+ . shortIDTests
110+ ] . update ( . regular, . test, plugins: [
111+ . swiftLint,
76112] )
77113
78- // Set the targets
79- package . targets = targets
114+ // MARK: - Internal Dependencies
115+ extension Target . Dependency {
116+ static let cache : Target . Dependency = . target(
117+ name: Cache
118+ )
119+ static let protected : Target . Dependency = . target(
120+ name: Protected
121+ )
122+ static let extensions : Target . Dependency = . target(
123+ name: Extensions
124+ )
125+ static let environmentProviders : Target . Dependency = . target(
126+ name: EnvironmentProviders
127+ )
128+ static let shortID : Target . Dependency = . target(
129+ name: ShortID
130+ )
131+ }
132+
133+ // MARK: - 3rd Party Dependencies
134+ extension Target . Dependency {
135+ static let dependencies : Target . Dependency = . product(
136+ name: " Dependencies " , package : " swift-composable-architecture "
137+ )
138+ static let orderedCollection : Target . Dependency = . product(
139+ name: " OrderedCollections " , package : " swift-collections "
140+ )
141+ static let deque : Target . Dependency = . product(
142+ name: " DequeModule " , package : " swift-collections "
143+ )
144+ static let xctestDynamicOverlay : Target . Dependency = . product(
145+ name: " XCTestDynamicOverlay " , package : " xctest-dynamic-overlay "
146+ )
147+ }
80148
149+ // MARK: - Plugin Usages
150+ extension Target . PluginUsage {
151+ static let swiftLint : Target . PluginUsage = . plugin(
152+ name: " SwiftLint " , package : " danthorpe-plugins "
153+ )
154+ }
81155
82156// MARK: - Helpers
83157
0 commit comments