-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathPackage.swift
2141 lines (1924 loc) · 79.9 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// swift-tools-version:5.10
import PackageDescription
var products: [Product] = []
var targets: [Target] = []
var plugins: [Target.PluginUsage] = []
let swiftSettings: [SwiftSetting] = [
.enableUpcomingFeature("BareSlashRegexLiterals"),
.enableUpcomingFeature("ConciseMagicFile"),
.enableUpcomingFeature("ExistentialAny"),
.enableUpcomingFeature("ForwardTrailingClosures"),
.enableUpcomingFeature("ImplicitOpenExistentials"),
.enableUpcomingFeature("StrictConcurrency"),
// Commented unsafe flags as this produces error if we try try to import the packages with specific tag.
// They should be activated to correct warnings
// .unsafeFlags(["-warn-concurrency", "-enable-actor-data-race-checks"]),
.spm
]
func products(from newProduct: String) -> [Product] {
let products: [Product] = [
.library(name: newProduct, targets: [newProduct])
]
let binaryFrameworksNotSupportingDynamicLibrary: [String] = [
.goLibsCryptoGo,
.goLibsCryptoSearchGo,
.goLibsCryptoPatchedGo,
.goLibsCryptoVPNPatchedGo,
.vCard
]
guard binaryFrameworksNotSupportingDynamicLibrary.contains(newProduct) == false else {
return products
}
return products
}
func add(products newProducts: [Product], targets newTargets: [Target]) {
products += newProducts
targets += newTargets
}
func add(product newProduct: String, targets newTargets: [Target]) {
add(
products: products(from: newProduct),
targets: newTargets
)
}
func add(products newProducts: [String], targets newTargets: [Target]) {
add(
products: newProducts.flatMap(products(from:)),
targets: newTargets
)
}
func coreTarget(name: String,
dependencies: [PackageDescription.Target.Dependency]? = nil,
path: String,
exclude: [String]? = nil,
sources: [String]? = nil,
settings: [SwiftSetting] = [.spm],
resources: [Resource]? = nil) -> Target {
.target(name: name,
dependencies: dependencies ?? [],
path: path,
exclude: exclude ?? [],
sources: sources,
resources: resources,
publicHeadersPath: nil,
cSettings: nil,
cxxSettings: nil,
swiftSettings: settings,
linkerSettings: nil,
plugins: plugins)
}
func coreTestTarget(name: String,
dependencies: [PackageDescription.Target.Dependency]? = nil,
path: String,
exclude: [String]? = nil,
resources: [Resource]? = nil) -> Target {
.testTarget(name: name,
dependencies: dependencies ?? [],
path: path,
exclude: exclude ?? [],
resources: resources,
cSettings: nil,
cxxSettings: nil,
swiftSettings: [.spm],
linkerSettings: nil,
plugins: plugins)
}
extension SwiftSetting {
static let spm: SwiftSetting = .define("SPM")
}
extension String {
// MARK: - Core module names
static let accountDeletion: String = "ProtonCoreAccountDeletion"
static let accountRecovery: String = "ProtonCoreAccountRecovery"
static let accountSwitcher: String = "ProtonCoreAccountSwitcher"
static let accountSwitcherResourcesiOS: String = "ProtonCoreAccountSwitcherResourcesiOS"
static let apiClient: String = "ProtonCoreAPIClient"
static let authentication: String = "ProtonCoreAuthentication"
static let authenticationKeyGeneration: String = "ProtonCoreAuthenticationKeyGeneration"
static let challenge: String = "ProtonCoreChallenge"
static let common: String = "ProtonCoreCommon"
static let crypto: String = "ProtonCoreCrypto"
static let cryptoGoInterface: String = "ProtonCoreCryptoGoInterface"
static let cryptoGoImplementation: String = "ProtonCoreCryptoGoImplementation"
static let cryptoPatchedGoImplementation: String = "ProtonCoreCryptoPatchedGoImplementation"
static let cryptoVPNPatchedGoImplementation: String = "ProtonCoreCryptoVPNPatchedGoImplementation"
static let cryptoSearchGoImplementation: String = "ProtonCoreCryptoSearchGoImplementation"
static let dataModel: String = "ProtonCoreDataModel"
static let doh: String = "ProtonCoreDoh"
static let environment: String = "ProtonCoreEnvironment"
static let features: String = "ProtonCoreFeatures"
static let featureFlags: String = "ProtonCoreFeatureFlags"
static let forceUpgrade: String = "ProtonCoreForceUpgrade"
static let foundations: String = "ProtonCoreFoundations"
static let goLibsCryptoGo: String = "GoLibsCryptoGo"
static let goLibsCryptoPatchedGo: String = "GoLibsCryptoPatchedGo"
static let goLibsCryptoVPNPatchedGo: String = "GoLibsCryptoVPNPatchedGo"
static let goLibsCryptoSearchGo: String = "GoLibsCryptoSearchGo"
static let hash: String = "ProtonCoreHash"
static let humanVerification: String = "ProtonCoreHumanVerification"
static let humanVerificationResourcesiOS: String = "ProtonCoreHumanVerificationResourcesiOS"
static let humanVerificationResourcesmacOS: String = "ProtonCoreHumanVerificationResourcesmacOS"
static let keymaker: String = "ProtonCoreKeymaker"
static let keyManager: String = "ProtonCoreKeyManager"
static let log: String = "ProtonCoreLog"
static let login: String = "ProtonCoreLogin"
static let loginUI: String = "ProtonCoreLoginUI"
static let loginUIResourcesiOS: String = "ProtonCoreLoginUIResourcesiOS"
static let missingScopes: String = "ProtonCoreMissingScopes"
static let networking: String = "ProtonCoreNetworking"
static let obfuscatedConstants: String = "ProtonCoreObfuscatedConstants"
static let observability: String = "ProtonCoreObservability"
static let passwordChange: String = "ProtonCorePasswordChange"
static let passwordRequest: String = "ProtonCorePasswordRequest"
static let payments: String = "ProtonCorePayments"
static let paymentsV2: String = "ProtonCorePaymentsV2"
static let paymentsUI: String = "ProtonCorePaymentsUI"
static let paymentsUIV2: String = "ProtonCorePaymentsUIV2"
static let paymentsUIResourcesiOS: String = "ProtonCorePaymentsUIResourcesiOS"
static let protonCoreUI: String = "ProtonCoreUI"
static let pushNotifications: String = "ProtonCorePushNotifications"
static let quarkCommands: String = "ProtonCoreQuarkCommands"
static let services: String = "ProtonCoreServices"
static let settings: String = "ProtonCoreSettings"
static let telemetry: String = "ProtonCoreTelemetry"
static let testingToolkit: String = "ProtonCoreTestingToolkit"
static let testingToolkitPerformance: String = "ProtonCoreTestingToolkitPerformance"
static let testingToolkitProxy: String = "ProtonCoreTestingToolkitProxy"
static let testingToolkitTestData: String = "ProtonCoreTestingToolkitTestData"
static let testingToolkitUnitTestsAccountDeletion: String = "ProtonCoreTestingToolkitUnitTestsAccountDeletion"
static let testingToolkitUnitTestsAuthentication: String = "ProtonCoreTestingToolkitUnitTestsAuthentication"
static let testingToolkitUnitTestsAuthenticationKeyGeneration: String = "ProtonCoreTestingToolkitUnitTestsAuthenticationKeyGeneration"
static let testingToolkitUnitTestsCore: String = "ProtonCoreTestingToolkitUnitTestsCore"
static let testingToolkitUnitTestsCryptoGoInterface: String = "ProtonCoreTestingToolkitUnitTestsCryptoGoInterface"
static let testingToolkitUnitTestsDataModel: String = "ProtonCoreTestingToolkitUnitTestsDataModel"
static let testingToolkitUnitTestsDoh: String = "ProtonCoreTestingToolkitUnitTestsDoh"
static let testingToolkitUnitTestsFeatureFlag: String = "ProtonCoreTestingToolkitUnitTestsFeatureFlag"
static let testingToolkitUnitTestsLogin: String = "ProtonCoreTestingToolkitUnitTestsLogin"
static let testingToolkitUnitTestsLoginUI: String = "ProtonCoreTestingToolkitUnitTestsLoginUI"
static let testingToolkitUnitTestsNetworking: String = "ProtonCoreTestingToolkitUnitTestsNetworking"
static let testingToolkitUnitTestsObservability: String = "ProtonCoreTestingToolkitUnitTestsObservability"
static let testingToolkitUnitTestsPayments: String = "ProtonCoreTestingToolkitUnitTestsPayments"
static let testingToolkitUnitTestsServices: String = "ProtonCoreTestingToolkitUnitTestsServices"
static let testingToolkitUITestsAccountDeletion: String = "ProtonCoreTestingToolkitUITestsAccountDeletion"
static let testingToolkitUITestsAccountSwitcher: String = "ProtonCoreTestingToolkitUITestsAccountSwitcher"
static let testingToolkitUITestsCore: String = "ProtonCoreTestingToolkitUITestsCore"
static let testingToolkitUITestsHumanVerification: String = "ProtonCoreTestingToolkitUITestsHumanVerification"
static let testingToolkitUITestsLogin: String = "ProtonCoreTestingToolkitUITestsLogin"
static let testingToolkitUITestsPaymentsUI: String = "ProtonCoreTestingToolkitUITestsPaymentsUI"
static let troubleShooting: String = "ProtonCoreTroubleShooting"
static let troubleShootingResourcesiOS: String = "ProtonCoreTroubleShootingResourcesiOS"
static let uiFoundations: String = "ProtonCoreUIFoundations"
static let uiFoundationsResourcesiOS: String = "ProtonCoreUIFoundationsResourcesiOS"
static let uiFoundationsResourcestvOS: String = "ProtonCoreUIFoundationsResourcestvOS"
static let uiFoundationsResourcesmacOS: String = "ProtonCoreUIFoundationsResourcesmacOS"
static let utilities: String = "ProtonCoreUtilities"
static let vCard: String = "ProtonCoreVCard"
// MARK: - Dependencies names
static let alamofire: String = "Alamofire"
static let cryptoSwift: String = "CryptoSwift"
static let ellipticCurveKeyPair: String = "EllipticCurveKeyPair"
static let fusion: String = "fusion"
static let fusionPackage: String = "apple-fusion"
static let jsonSchema: String = "JSONSchema"
static let jsonSchemaPackage: String = "JSONSchema.swift"
static let lottie: String = "Lottie"
static let lottiePackage: String = "lottie-ios"
static let ohhttpStubs: String = "OHHTTPStubsSwift"
static let ohhttpStubsPackage: String = "OHHTTPStubs"
static let reachabilitySwift: String = "Reachability"
static let reachabilitySwiftPackage: String = "Reachability.swift"
static let sentry: String = "Sentry"
static let sentryPackage: String = "sentry-cocoa"
static let sdWebImage: String = "SDWebImage"
static let swiftOTP: String = "SwiftOTP"
static let snapshotTesting: String = "SnapshotTesting"
static let snapshotTestingPackage: String = "swift-snapshot-testing"
static let trustKit: String = "TrustKit"
static let viewInspector: String = "ViewInspector"
static let yams: String = "Yams"
// MARK: - Plugin names
static let obfuscatedConstantsGenerationPlugin: String = "ObfuscatedConstantsGenerationPlugin"
}
extension Target.Dependency {
// MARK: - Core module targets
static var accountDeletion: Target.Dependency { .target(name: .accountDeletion) }
static var accountRecovery: Target.Dependency { .target(name: .accountRecovery) }
static var accountSwitcher: Target.Dependency { .target(name: .accountSwitcher) }
static var accountSwitcherResourcesiOS: Target.Dependency { .target(name: .accountSwitcherResourcesiOS,
condition: .when(platforms: [.iOS])) }
static var apiClient: Target.Dependency { .target(name: .apiClient) }
static var authentication: Target.Dependency { .target(name: .authentication) }
static var authenticationKeyGeneration: Target.Dependency { .target(name: .authenticationKeyGeneration) }
static var challenge: Target.Dependency { .target(name: .challenge) }
static var common: Target.Dependency { .target(name: .common) }
static var crypto: Target.Dependency { .target(name: .crypto) }
static var cryptoGoInterface: Target.Dependency { .target(name: .cryptoGoInterface) }
static var cryptoGoImplementation: Target.Dependency { .target(name: .cryptoGoImplementation) }
static var cryptoPatchedGoImplementation: Target.Dependency { .target(name: .cryptoPatchedGoImplementation) }
static var cryptoVPNPatchedGoImplementation: Target.Dependency { .target(name: .cryptoVPNPatchedGoImplementation) }
static var cryptoSearchGoImplementation: Target.Dependency { .target(name: .cryptoSearchGoImplementation) }
static var dataModel: Target.Dependency { .target(name: .dataModel) }
static var doh: Target.Dependency { .target(name: .doh) }
static var environment: Target.Dependency { .target(name: .environment) }
static var features: Target.Dependency { .target(name: .features) }
static var featureFlags: Target.Dependency { .target(name: .featureFlags) }
static var forceUpgrade: Target.Dependency { .target(name: .forceUpgrade) }
static var foundations: Target.Dependency { .target(name: .foundations) }
static var goLibsCryptoGo: Target.Dependency { .target(name: .goLibsCryptoGo) }
static var goLibsCryptoPatchedGo: Target.Dependency { .target(name: .goLibsCryptoPatchedGo) }
static var goLibsCryptoVPNPatchedGo: Target.Dependency { .target(name: .goLibsCryptoVPNPatchedGo) }
static var goLibsCryptoSearchGo: Target.Dependency { .target(name: .goLibsCryptoSearchGo) }
static var hash: Target.Dependency { .target(name: .hash) }
static var humanVerification: Target.Dependency { .target(name: .humanVerification) }
static var humanVerificationResourcesiOS: Target.Dependency { .target(name: .humanVerificationResourcesiOS,
condition: .when(platforms: [.iOS, .macCatalyst])) }
static var humanVerificationResourcesmacOS: Target.Dependency { .target(name: .humanVerificationResourcesmacOS,
condition: .when(platforms: [.macOS])) }
static var keymaker: Target.Dependency { .target(name: .keymaker) }
static var keyManager: Target.Dependency { .target(name: .keyManager) }
static var log: Target.Dependency { .target(name: .log) }
static var login: Target.Dependency { .target(name: .login) }
static var loginUI: Target.Dependency { .target(name: .loginUI) }
static var loginUIResourcesiOS: Target.Dependency { .target(name: .loginUIResourcesiOS,
condition: .when(platforms: [.iOS, .macCatalyst])) }
static var missingScopes: Target.Dependency { .target(name: .missingScopes) }
static var networking: Target.Dependency { .target(name: .networking) }
static var obfuscatedConstants: Target.Dependency { .target(name: .obfuscatedConstants) }
static var observability: Target.Dependency { .target(name: .observability) }
static var passwordChange: Target.Dependency { .target(name: .passwordChange) }
static var passwordRequest: Target.Dependency { .target(name: .passwordRequest) }
static var payments: Target.Dependency { .target(name: .payments) }
static var paymentsV2: Target.Dependency { .target(name: .paymentsV2) }
static var paymentsUI: Target.Dependency { .target(name: .paymentsUI) }
static var paymentsUIV2: Target.Dependency { .target(name: .paymentsUIV2) }
static var paymentsUIResourcesiOS: Target.Dependency { .target(name: .paymentsUIResourcesiOS,
condition: .when(platforms: [.iOS, .macCatalyst])) }
static var protonCoreUI: Target.Dependency { .target(name: .protonCoreUI) }
static var pushNotifications: Target.Dependency { .target(name: .pushNotifications) }
static var quarkCommands: Target.Dependency { .target(name: .quarkCommands) }
static var services: Target.Dependency { .target(name: .services) }
static var settings: Target.Dependency { .target(name: .settings) }
static var telemetry: Target.Dependency { .target(name: .telemetry) }
static var testingToolkit: Target.Dependency { .target(name: .testingToolkit) }
static var testingToolkitTestData: Target.Dependency { .target(name: .testingToolkitTestData) }
static var testingToolkitPerformance: Target.Dependency { .target(name: .testingToolkitPerformance) }
static var testingToolkitProxy: Target.Dependency { .target(name: .testingToolkitProxy) }
static var testingToolkitUnitTestsAccountDeletion: Target.Dependency { .target(name: .testingToolkitUnitTestsAccountDeletion) }
static var testingToolkitUnitTestsAuthentication: Target.Dependency { .target(name: .testingToolkitUnitTestsAuthentication) }
static var testingToolkitUnitTestsAuthenticationKeyGeneration: Target.Dependency { .target(name: .testingToolkitUnitTestsAuthenticationKeyGeneration) }
static var testingToolkitUnitTestsCore: Target.Dependency { .target(name: .testingToolkitUnitTestsCore) }
static var testingToolkitUnitTestsCryptoGoInterface: Target.Dependency { .target(name: .testingToolkitUnitTestsCryptoGoInterface) }
static var testingToolkitUnitTestsDataModel: Target.Dependency { .target(name: .testingToolkitUnitTestsDataModel) }
static var testingToolkitUnitTestsDoh: Target.Dependency { .target(name: .testingToolkitUnitTestsDoh) }
static var testingToolkitUnitTestsFeatureFlag: Target.Dependency { .target(name: .testingToolkitUnitTestsFeatureFlag) }
static var testingToolkitUnitTestsLogin: Target.Dependency { .target(name: .testingToolkitUnitTestsLogin) }
static var testingToolkitUnitTestsLoginUI: Target.Dependency { .target(name: .testingToolkitUnitTestsLoginUI) }
static var testingToolkitUnitTestsNetworking: Target.Dependency { .target(name: .testingToolkitUnitTestsNetworking) }
static var testingToolkitUnitTestsObservability: Target.Dependency { .target(name: .testingToolkitUnitTestsObservability) }
static var testingToolkitUnitTestsPayments: Target.Dependency { .target(name: .testingToolkitUnitTestsPayments) }
static var testingToolkitUnitTestsServices: Target.Dependency { .target(name: .testingToolkitUnitTestsServices) }
static var testingToolkitUITestsAccountDeletion: Target.Dependency { .target(name: .testingToolkitUITestsAccountDeletion) }
static var testingToolkitUITestsAccountSwitcher: Target.Dependency { .target(name: .testingToolkitUITestsAccountSwitcher) }
static var testingToolkitUITestsCore: Target.Dependency { .target(name: .testingToolkitUITestsCore) }
static var testingToolkitUITestsHumanVerification: Target.Dependency { .target(name: .testingToolkitUITestsHumanVerification) }
static var testingToolkitUITestsLogin: Target.Dependency { .target(name: .testingToolkitUITestsLogin) }
static var testingToolkitUITestsPaymentsUI: Target.Dependency { .target(name: .testingToolkitUITestsPaymentsUI) }
static var troubleShooting: Target.Dependency { .target(name: .troubleShooting) }
static var troubleShootingResourcesiOS: Target.Dependency { .target(name: .troubleShootingResourcesiOS,
condition: .when(platforms: [.iOS])) }
static var uiFoundations: Target.Dependency { .target(name: .uiFoundations) }
static var uiFoundationsResourcesiOS: Target.Dependency { .target(name: .uiFoundationsResourcesiOS,
condition: .when(platforms: [.iOS, .macCatalyst])) }
static var uiFoundationsResourcestvOS: Target.Dependency { .target(name: .uiFoundationsResourcestvOS,
condition: .when(platforms: [.tvOS])) }
static var uiFoundationsResourcesmacOS: Target.Dependency { .target(name: .uiFoundationsResourcesmacOS,
condition: .when(platforms: [.macOS])) }
static var utilities: Target.Dependency { .target(name: .utilities) }
static var vCard: Target.Dependency { .target(name: .vCard) }
// MARK: - Dependencies targets
static var alamofire: Target.Dependency { .product(name: .alamofire, package: .alamofire) }
static var cryptoSwift: Target.Dependency { .product(name: .cryptoSwift, package: .cryptoSwift) }
static var ellipticCurveKeyPair: Target.Dependency { .product(name: .ellipticCurveKeyPair, package: .ellipticCurveKeyPair) }
static var fusion: Target.Dependency { .product(name: .fusion, package: .fusionPackage, condition: .when(platforms: [.iOS])) }
static var jsonSchema: Target.Dependency { .product(name: .jsonSchema, package: .jsonSchemaPackage) }
static var lottie: Target.Dependency { .product(name: .lottie, package: .lottiePackage) }
static var ohhttpStubs: Target.Dependency { .product(name: .ohhttpStubs, package: .ohhttpStubsPackage) }
static var reachabilitySwift: Target.Dependency { .product(name: .reachabilitySwift, package: .reachabilitySwiftPackage) }
static var sentry: Target.Dependency { .product(name: .sentry, package: .sentryPackage) }
static var snapshotTesting: Target.Dependency { .product(name: .snapshotTesting, package: .snapshotTestingPackage) }
static var swiftOTP: Target.Dependency { .product(name: .swiftOTP, package: .swiftOTP) }
static var trustKit: Target.Dependency { .product(name: .trustKit, package: .trustKit) }
static var sdWebImage: Target.Dependency { .product(name: .sdWebImage, package: .sdWebImage) }
static var viewInspector: Target.Dependency { .product(name: .viewInspector, package: .viewInspector)}
static var yams: Target.Dependency { .product(name: .yams, package: .yams)}
// MARK: - Helpers
static var cryptoGoUsedInTests: Target.Dependency { .cryptoPatchedGoImplementation }
}
// MARK: - Module definitions
// MARK: AccountDeletion
add(
product: .accountDeletion,
targets: [
coreTarget(name: .accountDeletion,
dependencies: [
.doh,
.foundations,
.log,
.utilities,
.uiFoundations,
.authentication,
.networking,
.services
],
path: "libraries/AccountDeletion/Sources",
exclude: ["PMAccountDeletion"],
resources: [
.process("Shared/Resources")
]),
coreTestTarget(name: .accountDeletion + "Tests",
dependencies: [
.accountDeletion,
.testingToolkitUnitTestsAccountDeletion,
.testingToolkitUnitTestsDoh,
.testingToolkitUnitTestsNetworking,
.testingToolkitUnitTestsServices
],
path: "libraries/AccountDeletion/Tests/UnitTests"),
coreTestTarget(name: .accountDeletion + "LocalizationTests",
dependencies: [
.accountDeletion,
.testingToolkitUnitTestsCore
],
path: "libraries/AccountDeletion/Tests/LocalizationTests")
]
)
// MARK: AccountRecovery
add(
product: .accountRecovery,
targets: [
coreTarget(name: .accountRecovery,
dependencies: [
.featureFlags,
.pushNotifications,
.services,
.authentication,
.dataModel,
.uiFoundations,
.networking,
.passwordRequest
],
path: "libraries/AccountRecovery/Sources",
resources: [.process("Resources")]),
coreTestTarget(name: .accountRecovery + "Tests",
dependencies: [
.accountRecovery,
.testingToolkitUnitTestsFeatureFlag,
.testingToolkitUnitTestsServices,
.viewInspector,
],
path: "libraries/AccountRecovery/Tests")
]
)
// MARK: AccountSwitcher
add(
product: .accountSwitcher,
targets: [
coreTarget(name: .accountSwitcher,
dependencies: [
.uiFoundations,
.log,
.utilities,
.accountSwitcherResourcesiOS
],
path: "libraries/AccountSwitcher/Sources",
resources: [
.process("Resources")
]),
coreTarget(name: .accountSwitcherResourcesiOS,
path: "libraries/AccountSwitcher/Resources-iOS",
resources: [
.process("Resources")
]),
coreTestTarget(name: .accountSwitcher + "Tests",
dependencies: [
.accountSwitcher,
.testingToolkitUnitTestsCore
],
path: "libraries/AccountSwitcher/Tests/UnitTests",
exclude: ["__Snapshots__"]),
coreTestTarget(name: .accountSwitcher + "LocalizationTests",
dependencies: [
.accountSwitcher,
.testingToolkitUnitTestsCore
],
path: "libraries/AccountSwitcher/Tests/LocalizationTests")
]
)
// MARK: APIClient
add(
product: .apiClient,
targets: [
coreTarget(name: .apiClient,
dependencies: [
.dataModel,
.networking,
.services
],
path: "libraries/APIClient/Sources"),
coreTestTarget(name: .apiClient + "Tests",
dependencies: [
.apiClient,
.authentication,
.crypto,
.cryptoGoInterface,
.cryptoGoUsedInTests,
.challenge,
.testingToolkitTestData,
.testingToolkitUnitTestsAuthentication,
.ohhttpStubs,
.trustKit
],
path: "libraries/APIClient/Tests",
resources: [.process("TestData")])
]
)
// MARK: Authentication-KeyGeneration
add(
product: .authenticationKeyGeneration,
targets: [
coreTarget(name: .authenticationKeyGeneration,
dependencies: [
.authentication,
.crypto,
.cryptoGoInterface,
.hash,
.utilities
],
path: "libraries/Authentication-KeyGeneration/Sources"),
coreTestTarget(name: .authenticationKeyGeneration + "Tests",
dependencies: [
.authenticationKeyGeneration,
.cryptoGoUsedInTests,
.hash,
.obfuscatedConstants,
.ohhttpStubs
],
path: "libraries/Authentication-KeyGeneration/Tests",
resources: [.process("TestData")])
]
)
// MARK: Authentication
add(
product: .authentication,
targets: [
coreTarget(name: .authentication,
dependencies: [
.apiClient,
.crypto,
.cryptoGoInterface,
.featureFlags,
.foundations,
.observability,
.services
],
path: "libraries/Authentication/Sources"),
coreTestTarget(name: .authentication + "Tests",
dependencies: [
.authentication,
.cryptoGoInterface,
.cryptoGoUsedInTests,
.testingToolkitUnitTestsAuthentication,
.testingToolkitUnitTestsFeatureFlag,
.testingToolkitUnitTestsObservability,
.ohhttpStubs
],
path: "libraries/Authentication/Tests")
]
)
// MARK: Challenge
add(
product: .challenge,
targets: [
coreTarget(name: .challenge,
dependencies: [
.dataModel,
.foundations,
.uiFoundations
],
path: "libraries/Challenge/Sources",
resources: [
.process("PrivacyInfo.xcprivacy")
]),
coreTestTarget(name: .challenge + "Tests",
dependencies: [
.challenge
],
path: "libraries/Challenge/Tests")
]
)
// MARK: Common
add(
product: .common,
targets: [
coreTarget(name: .common,
dependencies: [
.networking,
.services,
.uiFoundations
],
path: "libraries/Common/Sources")
]
)
// MARK: Crypto
add(
product: .crypto,
targets: [
coreTarget(name: .crypto,
dependencies: [
.cryptoGoInterface,
.dataModel
],
path: "libraries/Crypto/Sources"),
coreTestTarget(name: .crypto + "Tests",
dependencies: [
.crypto,
.cryptoGoUsedInTests,
.utilities
],
path: "libraries/Crypto/Tests",
resources: [
.process("Resources")
]),
]
)
// MARK: CryptoGoImplementation
add(
products: [
.cryptoGoImplementation,
.cryptoPatchedGoImplementation,
.cryptoVPNPatchedGoImplementation,
.cryptoSearchGoImplementation
],
targets: [
coreTarget(name: .cryptoGoImplementation,
dependencies: [
.goLibsCryptoGo,
.cryptoGoInterface,
],
path: "libraries/CryptoGoImplementation/Crypto-Go"),
coreTarget(name: .cryptoPatchedGoImplementation,
dependencies: [
.goLibsCryptoPatchedGo,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Crypto-patched-Go"),
coreTarget(name: .cryptoVPNPatchedGoImplementation,
dependencies: [
.goLibsCryptoVPNPatchedGo,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Crypto+VPN-patched-Go"),
coreTarget(name: .cryptoSearchGoImplementation,
dependencies: [
.goLibsCryptoSearchGo,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Crypto+Search-Go"),
coreTestTarget(name: .cryptoGoImplementation + "Tests",
dependencies: [
.goLibsCryptoGo,
.cryptoGoImplementation,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Tests-Crypto-Go"),
coreTestTarget(name: .cryptoPatchedGoImplementation + "Tests",
dependencies: [
.goLibsCryptoPatchedGo,
.cryptoPatchedGoImplementation,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Tests-Crypto-patched-Go"),
coreTestTarget(name: .cryptoVPNPatchedGoImplementation + "Tests",
dependencies: [
.goLibsCryptoVPNPatchedGo,
.cryptoVPNPatchedGoImplementation,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Tests-Crypto+VPN-patched-Go"),
coreTestTarget(name: .cryptoSearchGoImplementation + "Tests",
dependencies: [
.goLibsCryptoSearchGo,
.cryptoSearchGoImplementation,
.cryptoGoInterface
],
path: "libraries/CryptoGoImplementation/Tests-Crypto+Search-Go")
]
)
// MARK: CryptoGoInterface
add(
product: .cryptoGoInterface,
targets: [
coreTarget(name: .cryptoGoInterface,
path: "libraries/CryptoGoInterface/Sources")
]
)
// MARK: DataModel
add(
product: .dataModel,
targets: [
coreTarget(name: .dataModel,
dependencies: [
.utilities
],
path: "libraries/DataModel/Sources"),
coreTestTarget(name: .dataModel + "Tests",
dependencies: [
.dataModel,
.testingToolkitUnitTestsDataModel
],
path: "libraries/DataModel/Tests")
]
)
// MARK: DoH
add(
product: .doh,
targets: [
coreTarget(name: .doh,
dependencies: [
.log,
.utilities
],
path: "libraries/DoH/Sources"),
coreTestTarget(name: .doh + "UnitTests",
dependencies: [
.doh,
.authentication,
.challenge,
.foundations,
.services,
.obfuscatedConstants,
.testingToolkitUnitTestsDoh,
.ohhttpStubs
],
path: "libraries/Doh/Tests/Unit"),
coreTestTarget(name: .doh + "IntegrationTests",
dependencies: [
.doh,
.authentication,
.environment,
.foundations,
.observability,
.services,
.testingToolkitUnitTestsCore
],
path: "libraries/Doh/Tests/Integration")
]
)
// MARK: Environment
add(
product: .environment,
targets: [
coreTarget(name: .environment,
dependencies: [
.doh,
.trustKit
],
path: "libraries/Environment/Sources"),
coreTestTarget(name: .environment + "Tests",
dependencies: [
.environment,
.testingToolkitUnitTestsDoh,
.ohhttpStubs
],
path: "libraries/Environment/Tests")
]
)
// MARK: Features
add(
product: .features,
targets: [
coreTarget(name: .features,
dependencies: [
.dataModel,
.hash,
.crypto,
.cryptoGoInterface,
.keyManager,
.authentication,
.networking
],
path: "libraries/Features/Sources")
]
)
// MARK: - Unleash Feature flags
add(
product: .featureFlags,
targets: [
coreTarget(name: .featureFlags,
dependencies: [
.log,
.networking,
.services,
],
path: "libraries/FeatureFlags/Sources",
settings: swiftSettings
),
coreTestTarget(name: .featureFlags + "Tests",
dependencies: [
.featureFlags,
.utilities,
.testingToolkitUnitTestsServices
],
path: "libraries/FeatureFlags/Tests",
resources: [.process("FeatureFlagsTests/QueryResources")])
]
)
// MARK: ForceUpgrade
add(
product: .forceUpgrade,
targets: [
coreTarget(name: .forceUpgrade,
dependencies: [
.uiFoundations,
.networking
],
path: "libraries/ForceUpgrade/Sources",
resources: [
.process("Shared/Resources")
]),
coreTestTarget(name: .forceUpgrade + "Tests",
dependencies: [
.forceUpgrade,
.testingToolkitUnitTestsCore
],
path: "libraries/ForceUpgrade/Tests/UnitTests"),
coreTestTarget(name: .forceUpgrade + "LocalizationTests",
dependencies: [
.forceUpgrade,
.testingToolkitUnitTestsCore
],
path: "libraries/ForceUpgrade/Tests/LocalizationTests")
]
)
// MARK: Foundations
add(
product: .foundations,
targets: [
coreTarget(name: .foundations,
dependencies: [
.log
],
path: "libraries/Foundations/Sources")
]
)
// MARK: GoLibs
add(
products: [
.goLibsCryptoGo,
.goLibsCryptoPatchedGo,
.goLibsCryptoVPNPatchedGo,
.goLibsCryptoSearchGo
],
targets: [
.binaryTarget(name: .goLibsCryptoGo, path: "vendor/Crypto-Go/GoLibs.xcframework"),
.binaryTarget(name: .goLibsCryptoPatchedGo, path: "vendor/Crypto-patched-Go/GoLibs.xcframework"),
.binaryTarget(name: .goLibsCryptoVPNPatchedGo, path: "vendor/Crypto+VPN-patched-Go/GoLibs.xcframework"),
.binaryTarget(name: .goLibsCryptoSearchGo, path: "vendor/Crypto+Search-Go/GoLibs.xcframework"),
]
)
// MARK: Hash
add(
product: .hash,
targets: [
coreTarget(name: .hash,
path: "libraries/Hash/Sources"),
coreTestTarget(name: .hash + "Tests",
dependencies: [
.hash
],
path: "libraries/Hash/Tests")
]
)
// MARK: HumanVerification
add(
product: .humanVerification,
targets: [
coreTarget(name: .humanVerification,
dependencies: [
.uiFoundations,
.foundations,
.utilities,
.apiClient,
.observability,
.crypto,
.cryptoGoInterface,
.dataModel,
.networking,
.telemetry,
.humanVerificationResourcesiOS,
.humanVerificationResourcesmacOS
],
path: "libraries/HumanVerification/Sources"),
coreTarget(name: .humanVerificationResourcesiOS,
path: "libraries/HumanVerification/Resources-iOS",
resources: [
.process("Resources-iOS")
]),
coreTarget(name: .humanVerificationResourcesmacOS,
path: "libraries/HumanVerification/Resources-macOS",
resources: [
.process("Resources-macOS")
]),
coreTestTarget(name: .humanVerification + "Tests",
dependencies: [
.challenge,
.humanVerification,
.cryptoGoUsedInTests,
.testingToolkitUnitTestsCore,
.testingToolkitUnitTestsDoh,
.testingToolkitUnitTestsFeatureFlag,
.testingToolkitUnitTestsObservability,
.testingToolkitUnitTestsServices
],
path: "libraries/HumanVerification/Tests/UnitTests",
exclude: ["__Snapshots__"]),
coreTestTarget(name: .humanVerification + "LocalizationTests",
dependencies: [
.humanVerification,
.testingToolkitUnitTestsCore
],
path: "libraries/HumanVerification/Tests/LocalizationTests")
]
)
// MARK: Keymaker
add(
product: .keymaker,
targets: [
coreTarget(name: .keymaker,
dependencies: [
.cryptoGoInterface,
.ellipticCurveKeyPair
],
path: "libraries/Keymaker/Sources"),
coreTestTarget(name: .keymaker + "Tests",
dependencies: [
.keymaker,
.cryptoGoUsedInTests,
.testingToolkitUnitTestsCore,
.cryptoSwift
],
path: "libraries/Keymaker/Tests")
]
)
// MARK: KeyManager
add(
product: .keyManager,
targets: [
coreTarget(name: .keyManager,
dependencies: [
.cryptoGoInterface,
.crypto,
.dataModel
],
path: "libraries/KeyManager/Sources"),
coreTestTarget(name: .keyManager + "Tests",
dependencies: [
.keyManager,
.cryptoGoUsedInTests
],
path: "libraries/KeyManager/Tests",
resources: [.process("TestData")])
]
)