-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathPodfile
More file actions
250 lines (204 loc) · 8.46 KB
/
Podfile
File metadata and controls
250 lines (204 loc) · 8.46 KB
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
# 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'
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', '~> 1.19.11'
end
def gravatar
# pod 'Gravatar', path: '../Gravatar-SDK-iOS'
# pod 'GravatarUI', path: '../Gravatar-SDK-iOS'
# pod 'Gravatar', git: 'https://github.com/Automattic/Gravatar-SDK-iOS', commit: ''
# pod 'GravatarUI', git: 'https://github.com/Automattic/Gravatar-SDK-iOS', commit: ''
pod 'Gravatar', '2.0.0'
pod 'GravatarUI', '2.0.0'
end
abstract_target 'Apps' do
project 'WordPress/WordPress.xcodeproj'
## Gutenberg (React Native)
## =====================
##
gutenberg_pod
## Third party libraries
## =====================
##
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 'FSInteractiveMap', git: 'https://github.com/wordpress-mobile/FSInteractiveMap.git', tag: '0.2.0'
pod 'CropViewController', '2.5.3'
## Automattic libraries
## ====================
##
gravatar
# Production
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 App iOS
## =================
##
target 'WordPress' do
target 'WordPressTest' do
inherit! :search_paths
gutenberg_pod
end
end
## Jetpack App iOS
## ===============
##
target 'Jetpack'
end
## Share Extension
## ===============
##
target 'WordPressShareExtension' do
project 'WordPress/WordPress.xcodeproj'
aztec
end
target 'JetpackShareExtension' do
project 'WordPress/WordPress.xcodeproj'
aztec
end
## DraftAction Extension
## =====================
##
target 'WordPressDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'
aztec
end
target 'JetpackDraftActionExtension' do
project 'WordPress/WordPress.xcodeproj'
aztec
end
## Tools
## ===================
##
def swiftlint_version
require 'yaml'
YAML.load_file('.swiftlint.yml')['swiftlint_version']
end
abstract_target 'Tools' do
pod 'SwiftLint', swiftlint_version
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 = %w[WordPressFlux]
dyanmic_framework_pods = %w[WordPressFlux]
# Statically linking Sentry results in a conflict with `NSDictionary.objectAtKeyPath`, but dynamically
# linking it resolves this.
dyanmic_framework_pods += %w[Sentry SentryPrivate]
pre_install do |installer|
static = []
dynamic = []
installer.pod_targets.each do |pod|
use_dynamic_frameworks = false
use_dynamic_frameworks = true if dyanmic_framework_pods.include? pod.name
# If this pod is a dependency of one of our shared targets, it must be linked dynamically
use_dynamic_frameworks = true if pod.target_definitions.any? { |t| shared_targets.include? t.name }
if use_dynamic_frameworks
dynamic << pod
pod.instance_variable_set(:@build_type, Pod::BuildType.dynamic_framework)
else
static << pod
pod.instance_variable_set(:@build_type, Pod::BuildType.static_framework)
end
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: 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.to_html(markdown)
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
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
post_integrate do
gutenberg_post_integrate
end