-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Podfile
412 lines (338 loc) · 12.9 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
# frozen_string_literal: true
require_relative './Gutenberg/cocoapods_helpers'
require 'xcodeproj'
# 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) }
VERSION_XCCONFIG_PATH = File.join(File.expand_path(__dir__), 'config', 'Common.xcconfig')
APP_IOS_DEPLOYMENT_TARGET = Gem::Version.new(Xcodeproj::Config.new(VERSION_XCCONFIG_PATH).to_hash['IPHONEOS_DEPLOYMENT_TARGET'])
platform :ios, APP_IOS_DEPLOYMENT_TARGET.version
inhibit_all_warnings!
use_frameworks!
workspace 'WordPress.xcworkspace'
## Pods shared between all the targets
## ===================================
##
def wordpress_shared
pod 'WordPressShared', '~> 2.2'
# pod 'WordPressShared', git: 'https://github.com/wordpress-mobile/WordPress-iOS-Shared.git', tag: ''
# pod 'WordPressShared', git: 'https://github.com/wordpress-mobile/WordPress-iOS-Shared.git', branch: 'trunk'
# pod 'WordPressShared', git: 'https://github.com/wordpress-mobile/WordPress-iOS-Shared.git', commit: ''
# pod 'WordPressShared', path: '../WordPress-iOS-Shared'
end
def aztec
## When using a tagged version, feel free to comment out the WordPress-Aztec-iOS line below.
## When using a commit number (during development) you should provide the same commit number for both pods.
##
# pod 'WordPress-Aztec-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
# pod 'WordPress-Editor-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', commit: ''
# pod 'WordPress-Editor-iOS', git: 'https://github.com/wordpress-mobile/AztecEditor-iOS.git', tag: ''
# pod 'WordPress-Editor-iOS', path: '../AztecEditor-iOS'
pod 'WordPress-Editor-iOS', '~> 1.19.9'
end
def wordpress_ui
pod 'WordPressUI', '~> 1.15'
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', tag: ''
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', branch: ''
# pod 'WordPressUI', git: 'https://github.com/wordpress-mobile/WordPressUI-iOS', commit: ''
# pod 'WordPressUI', path: '../WordPressUI-iOS'
end
def wordpress_kit
pod 'WordPressKit', '~> 8.5'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: ''
# pod 'WordPressKit', path: '../WordPressKit-iOS'
end
def kanvas
pod 'Kanvas', '~> 1.4.4'
# pod 'Kanvas', git: 'https://github.com/tumblr/Kanvas-iOS.git', tag: ''
# pod 'Kanvas', git: 'https://github.com/tumblr/Kanvas-iOS.git', commit: ''
# pod 'Kanvas', path: '../Kanvas-iOS'
end
def shared_with_all_pods
wordpress_shared
pod 'CocoaLumberjack/Swift', '~> 3.0'
pod 'NSObject-SafeExpectations', '~> 0.0.4'
end
def shared_with_networking_pods
pod 'Alamofire', '4.8.0'
pod 'Reachability', '3.2'
wordpress_kit
end
def shared_test_pods
pod 'OHHTTPStubs/Swift', '~> 9.1.0'
pod 'OCMock', '~> 3.4.3'
gutenberg_pod
end
def shared_with_extension_pods
shared_style_pods
pod 'ZIPFoundation', '~> 0.9.8'
pod 'Down', '~> 0.6.6'
end
def shared_style_pods
pod 'Gridicons', '~> 1.2'
end
abstract_target 'Apps' do
project 'WordPress/WordPress.xcodeproj'
shared_with_all_pods
shared_with_networking_pods
shared_with_extension_pods
## Gutenberg (React Native)
## =====================
##
gutenberg_pod
## Third party libraries
## =====================
##
pod 'Gifu', '3.3.1'
app_center_version = '~> 5.0'
app_center_configurations = %w[Release-Internal Release-Alpha]
pod 'AppCenter', app_center_version, configurations: app_center_configurations
pod 'AppCenter/Distribute', app_center_version, configurations: app_center_configurations
pod 'Starscream', '3.0.6'
pod 'SVProgressHUD', '2.2.5'
pod 'ZendeskSupportSDK', '5.3.0'
pod 'AlamofireImage', '3.5.2'
pod 'AlamofireNetworkActivityIndicator', '~> 2.4'
pod 'FSInteractiveMap', git: 'https://github.com/wordpress-mobile/FSInteractiveMap.git', tag: '0.2.0'
pod 'JTAppleCalendar', '~> 8.0.5'
pod 'CropViewController', '2.5.3'
pod 'SDWebImage', '~> 5.11.1'
## Automattic libraries
## ====================
##
wordpress_kit
wordpress_shared
kanvas
# Production
pod 'Automattic-Tracks-iOS', '~> 2.2'
# While in PR
# pod 'Automattic-Tracks-iOS', git: 'https://github.com/Automattic/Automattic-Tracks-iOS.git', branch: ''
# Local Development
# pod 'Automattic-Tracks-iOS', path: '~/Projects/Automattic-Tracks-iOS'
pod 'NSURL+IDN', '~> 0.4'
pod 'WPMediaPicker', '~> 1.8', '>= 1.8.10'
## while PR is in review:
# pod 'WPMediaPicker', git: 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', branch: ''
# pod 'WPMediaPicker', path: '../MediaPicker-iOS'
pod 'WordPressAuthenticator', '~> 7.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'
pod 'MediaEditor', '~> 1.2', '>= 1.2.2'
# pod 'MediaEditor', git: 'https://github.com/wordpress-mobile/MediaEditor-iOS.git', commit: ''
# pod 'MediaEditor', path: '../MediaEditor-iOS'
aztec
wordpress_ui
shared_style_pods
## WordPress App iOS
## =================
##
target 'WordPress' do
target 'WordPressTest' do
inherit! :search_paths
shared_test_pods
end
end
## Jetpack App iOS
## ===============
##
target 'Jetpack'
end
## Share Extension
## ===============
##
target 'WordPressShareExtension' do
project 'WordPress/WordPress.xcodeproj'
shared_with_extension_pods
aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end
target 'JetpackShareExtension' do
project 'WordPress/WordPress.xcodeproj'
shared_with_extension_pods
aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end
## DraftAction Extension
## =====================
##
target 'WordPressDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'
shared_with_extension_pods
aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end
target 'JetpackDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'
shared_with_extension_pods
aztec
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end
## Widgets
## ============
##
target 'JetpackStatsWidgets' do
project 'WordPress/WordPress.xcodeproj'
shared_with_all_pods
shared_with_networking_pods
shared_style_pods
wordpress_ui
end
## Intents
## ============
##
target 'JetpackIntents' do
project 'WordPress/WordPress.xcodeproj'
shared_with_all_pods
shared_with_networking_pods
wordpress_ui
end
## Notification Service Extension
## ==============================
##
target 'WordPressNotificationServiceExtension' do
project 'WordPress/WordPress.xcodeproj'
wordpress_kit
wordpress_shared
wordpress_ui
end
target 'JetpackNotificationServiceExtension' do
project 'WordPress/WordPress.xcodeproj'
wordpress_kit
wordpress_shared
wordpress_ui
end
## Screenshot Generation
## ===================
##
target 'WordPressScreenshotGeneration' do
project 'WordPress/WordPress.xcodeproj'
end
## UI Tests
## ===================
##
target 'WordPressUITests' do
project 'WordPress/WordPress.xcodeproj'
end
abstract_target 'Tools' do
pod 'SwiftLint', '~> 0.50'
end
# 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 = ['WordPressFlux']
pre_install do |installer|
static = []
dynamic = []
installer.pod_targets.each do |pod|
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
if %w[Sentry SentryPrivate].include? pod.name
dynamic << pod
next
end
# If this pod is a dependency of one of our shared targets, it must be linked dynamically
if pod.target_definitions.any? { |t| shared_targets.include? t.name }
dynamic << pod
next
end
static << pod
pod.instance_variable_set(:@build_type, Pod::BuildType.static_framework)
end
puts "Installing #{static.count} pods as static frameworks"
puts "Installing #{dynamic.count} pods as dynamic frameworks"
end
post_install do |installer|
gutenberg_post_install(installer:)
project_root = File.dirname(__FILE__)
## Convert the 3rd-party license acknowledgements markdown into html for use in the app
require 'commonmarker'
acknowledgements = 'Acknowledgments'
markdown = File.read("#{project_root}/Pods/Target Support Files/Pods-Apps-WordPress/Pods-Apps-WordPress-acknowledgements.markdown")
rendered_html = CommonMarker.render_html(markdown, :DEFAULT)
styled_html = "<head>
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
font-size: 16px;
color: #1a1a1a;
margin: 20px;
}
@media (prefers-color-scheme: dark) {
body {
background: #1a1a1a;
color: white;
}
}
pre {
white-space: pre-wrap;
}
</style>
<title>
#{acknowledgements}
</title>
</head>
<body>
#{rendered_html}
</body>"
## Remove the <h1>, since we've promoted it to <title>
styled_html = styled_html.sub('<h1>Acknowledgements</h1>', '')
## The glog library's license contains a URL that does not wrap in the web view,
## leading to a large right-hand whitespace gutter. Work around this by explicitly
## inserting a <br> in the HTML. Use gsub juuust in case another one sneaks in later.
styled_html = styled_html.gsub('p?hl=en#dR3YEbitojA/COPYING', 'p?hl=en#dR3YEbitojA/COPYING<br>')
File.write("#{project_root}/Pods/Target Support Files/Pods-Apps-WordPress/acknowledgements.html", styled_html)
# 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|
# Exclude RCT-Folly as it requires explicit deployment target https://git.io/JPb73
next unless target.name != 'RCT-Folly'
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
# Fix a code signing issue in Xcode 14 beta.
# This solution is suggested here: https://github.com/CocoaPods/CocoaPods/issues/11402#issuecomment-1189861270
# ====================================
#
# TODO: fix the linting issue if this workaround is still needed in Xcode 14 GM.
# rubocop:disable Style/CombinableLoops
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
# Flag Alpha builds for Tracks
# ============================
#
tracks_target = installer.pods_project.targets.find { |target| target.name == 'Automattic-Tracks-iOS' }
# This will crash if/when we'll remove Tracks.
# That's okay because it is a crash we'll only have to address once.
tracks_target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'ALPHA=1'] if (config.name == 'Release-Alpha') || (config.name == 'Release-Internal')
end
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