-
Notifications
You must be signed in to change notification settings - Fork 109
/
Podfile
441 lines (368 loc) · 10.6 KB
/
Podfile
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
# frozen_string_literal: true
require 'cocoapods-catalyst-support'
# For security reasons, please always keep the wordpress-mobile source first and the CDN second.
# For more info, see https://github.com/wordpress-mobile/cocoapods-specs#source-order-and-security-considerations
install! 'cocoapods', warn_for_multiple_pod_sources: false
source 'https://github.com/wordpress-mobile/cocoapods-specs.git'
source 'https://cdn.cocoapods.org/'
raise 'Please run CocoaPods via `bundle exec`' unless %w[BUNDLE_BIN_PATH BUNDLE_GEMFILE].any? { |k| ENV.key?(k) }
inhibit_all_warnings!
use_frameworks! # Defaulting to use_frameworks! See pre_install hook below for static linking.
use_modular_headers!
app_ios_deployment_target = Gem::Version.new('16.0')
app_watchos_deployment_target = Gem::Version.new('9.0')
platform :ios, app_ios_deployment_target.version
workspace 'WooCommerce.xcworkspace'
## Pods shared between all the targets
## =====================================
##
def aztec
pod 'WordPress-Editor-iOS', '~> 1.19'
# pod 'WordPress-Editor-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
# pod 'WordPress-Aztec-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
end
def tracks
pod 'Automattic-Tracks-iOS', '~> 3.4.1'
# pod 'Automattic-Tracks-iOS', :git => 'https://github.com/Automattic/Automattic-Tracks-iOS.git', :branch => 'trunk'
# pod 'Automattic-Tracks-iOS', :git => 'https://github.com/Automattic/Automattic-Tracks-iOS.git', :commit => ''
# pod 'Automattic-Tracks-iOS', :path => '../Automattic-Tracks-iOS'
end
def wordpress_shared
pod 'WordPressShared', '~> 2.1'
end
def keychain
pod 'KeychainAccess', '~> 4.2.2'
end
def alamofire
pod 'Alamofire', '~> 5.0'
end
def cocoa_lumberjack
pod 'CocoaLumberjack/Swift', '~> 3.8.5'
end
def stripe_terminal
pod 'StripeTerminal', '~> 3.9.1'
end
def networking_pods
alamofire
cocoa_lumberjack
pod 'Sourcery', '~> 1.0.3', configuration: 'Debug'
wordpress_shared
# Used for HTML parsing
aztec
# Used for storing application password
keychain
end
def networking_watch_os_pods
alamofire
cocoa_lumberjack
keychain
end
# Main Target!
# ============
#
target 'WooCommerce' do
project 'WooCommerce/WooCommerce.xcodeproj'
# Automattic Libraries
# ====================
#
tracks
pod 'Gridicons', '~> 1.2.0'
# To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1
pod 'WordPressAuthenticator', '~> 9.10.0'
# pod 'WordPressAuthenticator', git: 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', branch: ''
# pod 'WordPressAuthenticator', git: 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', commit: ''
# pod 'WordPressAuthenticator', path: '../WordPressAuthenticator-iOS'
wordpress_shared
pod 'WordPressUI', '~> 1.15'
# pod 'WordPressUI', :git => 'https://github.com/wordpress-mobile/WordPressUI-iOS.git', :branch => ''
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS.git', commit: ''
aztec
pod 'WPMediaPicker', '~> 1.8'
# pod 'WPMediaPicker', git: 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', commit: ''
# External Libraries
# ==================
#
alamofire
cocoa_lumberjack
keychain
pod 'ZendeskSupportSDK', '~> 8.0.3'
stripe_terminal
pod 'Kingfisher', '~> 7.6.2'
pod 'Wormholy', '~> 1.6.6', configurations: ['Debug']
# Unit Tests
# ==========
#
target 'WooCommerceTests' do
inherit! :search_paths
end
end
# StoreWidget Target
# ==========
#
target 'StoreWidgetsExtension' do
project 'WooCommerce/WooCommerce.xcodeproj'
tracks
keychain
end
# Notification Content Target
# ==========
#
target 'NotificationExtension' do
project 'WooCommerce/WooCommerce.xcodeproj'
tracks
keychain
end
# Woo Watch App Target
# ==========
#
target 'Woo Watch App' do
project 'WooCommerce/WooCommerce.xcodeproj'
platform :watchos, app_watchos_deployment_target.version
pod 'Sentry', '~> 8.36.0'
networking_watch_os_pods
end
# Yosemite Layer:
# ===============
#
def yosemite_pods
alamofire
stripe_terminal
cocoa_lumberjack
networking_pods
aztec
end
# Yosemite Target:
# ================
#
target 'Yosemite' do
project 'Yosemite/Yosemite.xcodeproj'
yosemite_pods
end
# Unit Tests
# ==========
#
target 'YosemiteTests' do
project 'Yosemite/Yosemite.xcodeproj'
yosemite_pods
end
# WooFoundation Layer:
# ===============
#
def woofoundation_pods
cocoa_lumberjack
end
def woofoundation_watchos_pods
cocoa_lumberjack
end
# Tools Target:
# ================
#
target 'WooFoundation' do
project 'WooFoundation/WooFoundation.xcodeproj'
woofoundation_pods
end
target 'WooFoundationWatchOS' do
project 'WooFoundation/WooFoundation.xcodeproj'
platform :watchos, app_watchos_deployment_target.version
woofoundation_watchos_pods
end
# Unit Tests
# ==========
#
target 'WooFoundationTests' do
project 'WooFoundation/WooFoundation.xcodeproj'
woofoundation_pods
end
# Networking Target:
# ==================
#
target 'Networking' do
project 'Networking/Networking.xcodeproj'
networking_pods
end
# Networking WatchOS Target:
# ==================
#
target 'NetworkingWatchOS' do
project 'Networking/Networking.xcodeproj'
platform :watchos, app_watchos_deployment_target.version
networking_watch_os_pods
end
# Unit Tests
# ==========
#
target 'NetworkingTests' do
project 'Networking/Networking.xcodeproj'
networking_pods
# Including `yosemite_pods` because `Fakes.framework` has a dependency `Yosemite` while `Networking` does not.
yosemite_pods
end
# Storage Layer:
# ==============
#
def storage_pods
cocoa_lumberjack
end
# Storage Target:
# ===============
#
target 'Storage' do
project 'Storage/Storage.xcodeproj'
storage_pods
end
# Unit Tests
# ==========
#
target 'StorageTests' do
project 'Storage/Storage.xcodeproj'
storage_pods
end
# Hardware Layer:
# =================
#
def hardware_pods
stripe_terminal
cocoa_lumberjack
end
# Hardware Target:
# ==================
#
target 'Hardware' do
project 'Hardware/Hardware.xcodeproj'
hardware_pods
end
# Unit Tests
# ==========
#
target 'HardwareTests' do
project 'Hardware/Hardware.xcodeproj'
hardware_pods
end
# SampleReceiptPrinter Target:
# ==================
#
target 'SampleReceiptPrinter' do
project 'Hardware/Hardware.xcodeproj'
hardware_pods
end
# Experiments Layer:
# ==================
#
def experiments_pods
tracks
cocoa_lumberjack
end
# Experiments Target:
# ===================
#
target 'Experiments' do
project 'Experiments/Experiments.xcodeproj'
experiments_pods
end
# Unit Tests
# ==========
#
target 'ExperimentsTests' do
project 'Experiments/Experiments.xcodeproj'
experiments_pods
end
# Tools
# ==========
#
def swiftlint_version
require 'yaml'
YAML.load_file('.swiftlint.yml')['swiftlint_version']
end
abstract_target 'Tools' do
pod 'SwiftLint', swiftlint_version
end
# Workarounds:
# ============
#
# Static Frameworks:
# ============
#
# Make all pods that are not shared across multiple targets into static frameworks by overriding the static_framework? function to return true
# Linking the shared frameworks statically would lead to duplicate symbols
# A future version of CocoaPods may make this easier to do. See https://github.com/CocoaPods/CocoaPods/issues/7428
shared_targets = %w[Storage Networking Yosemite Hardware]
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
dynamic_pods = ['Sentry']
pre_install do |installer|
static = []
dynamic = []
installer.pod_targets.each do |pod|
# If this pod is a dependency of one of our shared targets or its explicitly excluded, it must be linked dynamically
if pod.target_definitions.any? { |t| shared_targets.include? t.name } || dynamic_pods.include?(pod.name)
dynamic << pod
next
end
static << pod
def pod.static_framework?
true
end
end
puts "Installing #{static.count} pods as static frameworks"
puts "Installing #{dynamic.count} pods as dynamic frameworks"
# Force CocoaLumberjack Swift version
installer.analysis_result.specifications.each do |s|
s.swift_version = '5.0' if s.name == 'CocoaLumberjack'
end
end
# Configure your macCatalyst dependencies
catalyst_configuration do
# Uncomment the next line for a verbose output
# verbose!
# ios '<pod_name>' # This dependency will only be available for iOS
ios 'StripeTerminal'
ios 'ZendeskSupportSDK'
# macos '<pod_name>' # This dependency will only be available for macOS
end
post_install do |installer|
installer.configure_catalyst
# Workaround: Drop 32 Bit Architectures
# =====================================
#
installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
configuration.build_settings['VALID_ARCHS'] = '$(ARCHS_STANDARD)'
end
# Let Pods targets inherit deployment target from the app
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/4859
# =====================================
#
installer.pods_project.targets.each do |target|
# Fix bundle targets' 'Signing Certificate' to 'Sign to Run Locally'
if target.respond_to?(:product_type) && (target.product_type == 'com.apple.product-type.bundle')
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_IDENTITY[sdk=macosx*]'] = '-'
end
end
target.build_configurations.each do |configuration|
pod_ios_deployment_target = Gem::Version.new(configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'])
configuration.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' if pod_ios_deployment_target <= app_ios_deployment_target
end
end
# Flag Alpha builds for Tracks
# ============================
# rubocop:disable Style/CombinableLoops
installer.pods_project.targets.each do |target|
next unless target.name == 'Automattic-Tracks-iOS'
target.build_configurations.each do |config|
next unless config.name == 'Release-Alpha'
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'ALPHA=1']
end
end
# Fix a code signing issue in Xcode 14 beta.
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1189861270
# ====================================
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['CODE_SIGN_IDENTITY'] = ''
end
end
# rubocop:enable Style/CombinableLoops
yellow_marker = "\033[33m"
reset_marker = "\033[0m"
puts "#{yellow_marker}The abstract target warning below is expected. Feel free to ignore it.#{reset_marker}"
end