cocoapods 1.5.2 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +365 -1
- data/bin/pod +1 -1
- data/lib/cocoapods/command/cache/clean.rb +1 -1
- data/lib/cocoapods/command/init.rb +4 -2
- data/lib/cocoapods/command/install.rb +7 -0
- data/lib/cocoapods/command/lib/lint.rb +8 -1
- data/lib/cocoapods/command/outdated.rb +4 -9
- data/lib/cocoapods/command/repo/add.rb +1 -1
- data/lib/cocoapods/command/repo/list.rb +1 -1
- data/lib/cocoapods/command/repo/push.rb +17 -12
- data/lib/cocoapods/command/repo/remove.rb +1 -1
- data/lib/cocoapods/command/repo/update.rb +1 -1
- data/lib/cocoapods/command/setup.rb +1 -1
- data/lib/cocoapods/command/spec/create.rb +39 -39
- data/lib/cocoapods/command/spec/lint.rb +8 -1
- data/lib/cocoapods/command.rb +3 -1
- data/lib/cocoapods/config.rb +13 -2
- data/lib/cocoapods/downloader/cache.rb +1 -1
- data/lib/cocoapods/executable.rb +3 -3
- data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
- data/lib/cocoapods/external_sources.rb +7 -4
- data/lib/cocoapods/gem_version.rb +1 -1
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
- data/lib/cocoapods/generator/acknowledgements/plist.rb +13 -2
- data/lib/cocoapods/generator/app_target_helper.rb +141 -17
- data/lib/cocoapods/generator/copy_resources_script.rb +14 -3
- data/lib/cocoapods/generator/dummy_source.rb +14 -5
- data/lib/cocoapods/generator/embed_frameworks_script.rb +37 -20
- data/lib/cocoapods/generator/header.rb +1 -1
- data/lib/cocoapods/generator/info_plist_file.rb +12 -4
- data/lib/cocoapods/generator/prefix_header.rb +2 -2
- data/lib/cocoapods/hooks_manager.rb +28 -17
- data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
- data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +14 -6
- data/lib/cocoapods/installer/analyzer/pod_variant.rb +4 -5
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -14
- data/lib/cocoapods/installer/analyzer/specs_state.rb +28 -4
- data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +27 -14
- data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
- data/lib/cocoapods/installer/analyzer.rb +391 -284
- data/lib/cocoapods/installer/installation_options.rb +2 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
- data/lib/cocoapods/installer/post_install_hooks_context.rb +72 -47
- data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
- data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +69 -29
- data/lib/cocoapods/installer/user_project_integrator.rb +6 -4
- data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
- data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +104 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +23 -50
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +296 -177
- data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +51 -33
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +62 -69
- data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
- data/lib/cocoapods/installer/xcode/pods_project_generator.rb +130 -122
- data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
- data/lib/cocoapods/installer.rb +140 -63
- data/lib/cocoapods/project.rb +16 -14
- data/lib/cocoapods/resolver/resolver_specification.rb +41 -0
- data/lib/cocoapods/resolver.rb +79 -98
- data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
- data/lib/cocoapods/sandbox/headers_store.rb +9 -8
- data/lib/cocoapods/sandbox/path_list.rb +5 -8
- data/lib/cocoapods/sandbox.rb +31 -43
- data/lib/cocoapods/sources_manager.rb +1 -1
- data/lib/cocoapods/target/aggregate_target.rb +143 -85
- data/lib/cocoapods/target/build_settings.rb +1124 -0
- data/lib/cocoapods/target/framework_paths.rb +36 -0
- data/lib/cocoapods/target/pod_target.rb +198 -295
- data/lib/cocoapods/target.rb +92 -37
- data/lib/cocoapods/user_interface.rb +5 -0
- data/lib/cocoapods/validator.rb +149 -44
- data/lib/cocoapods.rb +0 -1
- metadata +31 -23
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
- data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
- data/lib/cocoapods/generator/xcconfig.rb +0 -13
@@ -1,558 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/object/try'
|
2
|
-
|
3
|
-
module Pod
|
4
|
-
module Generator
|
5
|
-
module XCConfig
|
6
|
-
# Stores the shared logic of the classes of the XCConfig module.
|
7
|
-
#
|
8
|
-
module XCConfigHelper
|
9
|
-
# @return [String] Used as alias for BUILD_DIR, so that when this
|
10
|
-
# is overridden in the user target, the user can override
|
11
|
-
# this variable to point to the standard directory, which
|
12
|
-
# will be used by CocoaPods.
|
13
|
-
#
|
14
|
-
BUILD_DIR_VARIABLE = '${PODS_BUILD_DIR}'.freeze
|
15
|
-
|
16
|
-
# @return [String] Used as alias for CONFIGURATION_BUILD_DIR, so that
|
17
|
-
# when this is overridden per {PodTarget}, it is still possible
|
18
|
-
# to reference other build products relative to the original
|
19
|
-
# path. Furthermore if it was overridden in the user target,
|
20
|
-
# the user can override this variable to point to the standard
|
21
|
-
# directory, which will be used by CocoaPods.
|
22
|
-
#
|
23
|
-
CONFIGURATION_BUILD_DIR_VARIABLE = '${PODS_CONFIGURATION_BUILD_DIR}'.freeze
|
24
|
-
|
25
|
-
# Converts an array of strings to a single string where the each string
|
26
|
-
# is surrounded by double quotes and separated by a space. Used to
|
27
|
-
# represent strings in a xcconfig file.
|
28
|
-
#
|
29
|
-
# @param [Array<String>] strings
|
30
|
-
# a list of strings.
|
31
|
-
#
|
32
|
-
# @param [String] prefix
|
33
|
-
# optional prefix, such as a flag or option.
|
34
|
-
#
|
35
|
-
# @return [String] the resulting string.
|
36
|
-
#
|
37
|
-
def self.quote(strings, prefix = nil)
|
38
|
-
prefix = "#{prefix} " if prefix
|
39
|
-
strings.sort.map { |s| %W( #{prefix}"#{s}" ) }.join(' ')
|
40
|
-
end
|
41
|
-
|
42
|
-
# Return the default linker flags
|
43
|
-
#
|
44
|
-
# @param [Target] target
|
45
|
-
# the target, which is used to check if the ARC compatibility
|
46
|
-
# flag is required.
|
47
|
-
#
|
48
|
-
# @param [Boolean] include_objc_flag
|
49
|
-
# whether to include `-ObjC` in the other linker flags
|
50
|
-
#
|
51
|
-
# @return [String] the default linker flags. `-ObjC` is optionally included depending
|
52
|
-
# on the target while `-fobjc-arc` is included only if requested in the Podfile.
|
53
|
-
#
|
54
|
-
def self.default_ld_flags(target, include_objc_flag = false)
|
55
|
-
ld_flags = ''
|
56
|
-
ld_flags << '-ObjC' if include_objc_flag
|
57
|
-
if target.podfile.set_arc_compatibility_flag? &&
|
58
|
-
target.spec_consumers.any?(&:requires_arc?)
|
59
|
-
ld_flags << ' -fobjc-arc'
|
60
|
-
end
|
61
|
-
ld_flags.strip
|
62
|
-
end
|
63
|
-
|
64
|
-
# Configures the given Xcconfig
|
65
|
-
#
|
66
|
-
# @param [Target] target
|
67
|
-
# The root target, may be nil.
|
68
|
-
#
|
69
|
-
# @param [PodTarget] pod_target
|
70
|
-
# The pod target, which holds the list of +Spec::FileAccessor+.
|
71
|
-
#
|
72
|
-
# @param [Xcodeproj::Config] xcconfig
|
73
|
-
# The xcconfig to edit.
|
74
|
-
#
|
75
|
-
# @param [Boolean] include_ld_flags
|
76
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
77
|
-
#
|
78
|
-
# @param [Boolean] test_xcconfig
|
79
|
-
# Whether the settings for dependent targets are being generated for a test xcconfig or not.
|
80
|
-
#
|
81
|
-
# @return [void]
|
82
|
-
#
|
83
|
-
def self.add_settings_for_file_accessors_of_target(target, pod_target, xcconfig, include_ld_flags = true, test_xcconfig = false)
|
84
|
-
file_accessors = pod_target.file_accessors
|
85
|
-
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } unless test_xcconfig
|
86
|
-
file_accessors.each do |file_accessor|
|
87
|
-
if target.nil? || !file_accessor.spec.test_specification?
|
88
|
-
XCConfigHelper.add_spec_build_settings_to_xcconfig(file_accessor.spec_consumer, xcconfig) if include_ld_flags
|
89
|
-
XCConfigHelper.add_static_dependency_build_settings(target, pod_target, xcconfig, file_accessor, include_ld_flags)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
XCConfigHelper.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags, test_xcconfig)
|
93
|
-
if pod_target.requires_frameworks?
|
94
|
-
pod_target.dependent_targets.each do |dependent_target|
|
95
|
-
XCConfigHelper.add_dynamic_dependency_build_settings(target, dependent_target, xcconfig, include_ld_flags, test_xcconfig)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
# Adds build settings for static vendored frameworks and libraries.
|
101
|
-
#
|
102
|
-
# @param [Target] target
|
103
|
-
# The root target, may be nil.
|
104
|
-
#
|
105
|
-
# @param [PodTarget] pod_target
|
106
|
-
# The pod target, which holds the list of +Spec::FileAccessor+.
|
107
|
-
#
|
108
|
-
# @param [Xcodeproj::Config] xcconfig
|
109
|
-
# The xcconfig to edit.
|
110
|
-
#
|
111
|
-
# @param [Spec::FileAccessor] file_accessor
|
112
|
-
# The file accessor, which holds the list of static frameworks.
|
113
|
-
#
|
114
|
-
# @param [Boolean] include_ld_flags
|
115
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
116
|
-
#
|
117
|
-
# @return [void]
|
118
|
-
#
|
119
|
-
def self.add_static_dependency_build_settings(target, pod_target, xcconfig, file_accessor, include_ld_flags)
|
120
|
-
if target.nil? || !file_accessor.spec.test_specification?
|
121
|
-
adds_other_ldflags = include_ld_flags && XCConfigHelper.links_dependency?(target, pod_target)
|
122
|
-
file_accessor.vendored_static_frameworks.each do |vendored_static_framework|
|
123
|
-
XCConfigHelper.add_framework_build_settings(vendored_static_framework, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
|
124
|
-
end
|
125
|
-
file_accessor.vendored_static_libraries.each do |vendored_static_library|
|
126
|
-
XCConfigHelper.add_library_build_settings(vendored_static_library, xcconfig, pod_target.sandbox.root, adds_other_ldflags)
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
# @param [AggregateTarget] aggregate_target
|
132
|
-
# The aggregate target, may be nil.
|
133
|
-
#
|
134
|
-
# @param [PodTarget] pod_target
|
135
|
-
# The pod target to link or not.
|
136
|
-
#
|
137
|
-
# @return [Boolean] Whether static dependency should be added to the 'OTHER_LDFLAGS'
|
138
|
-
# of the aggregate target. Aggregate targets that inherit search paths will only link
|
139
|
-
# if the target has explicitly declared the pod dependency.
|
140
|
-
#
|
141
|
-
def self.links_dependency?(aggregate_target, pod_target)
|
142
|
-
return true if aggregate_target.nil? || aggregate_target.target_definition.inheritance == 'complete'
|
143
|
-
aggregate_target.pod_targets_to_link.include?(pod_target)
|
144
|
-
end
|
145
|
-
|
146
|
-
# Adds build settings for dynamic vendored frameworks and libraries.
|
147
|
-
#
|
148
|
-
# @param [Target] target
|
149
|
-
# The root target, may be nil.
|
150
|
-
#
|
151
|
-
# @param [PodTarget] pod_target
|
152
|
-
# The pod target, which holds the list of +Spec::FileAccessor+.
|
153
|
-
#
|
154
|
-
# @param [Xcodeproj::Config] xcconfig
|
155
|
-
# The xcconfig to edit.
|
156
|
-
#
|
157
|
-
# @param [Boolean] include_ld_flags
|
158
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
159
|
-
#
|
160
|
-
# @param [Boolean] test_xcconfig
|
161
|
-
# Whether the settings for dependent targets are being generated for a test xcconfig or not.
|
162
|
-
#
|
163
|
-
# @return [void]
|
164
|
-
#
|
165
|
-
def self.add_dynamic_dependency_build_settings(target, pod_target, xcconfig, include_ld_flags, test_xcconfig)
|
166
|
-
file_accessors = pod_target.file_accessors
|
167
|
-
file_accessors = file_accessors.reject { |f| f.spec.test_specification? } unless test_xcconfig
|
168
|
-
file_accessors.each do |file_accessor|
|
169
|
-
if target.nil? || !file_accessor.spec.test_specification?
|
170
|
-
file_accessor.vendored_dynamic_frameworks.each do |vendored_dynamic_framework|
|
171
|
-
XCConfigHelper.add_framework_build_settings(vendored_dynamic_framework, xcconfig, pod_target.sandbox.root, include_ld_flags)
|
172
|
-
end
|
173
|
-
file_accessor.vendored_dynamic_libraries.each do |vendored_dynamic_library|
|
174
|
-
XCConfigHelper.add_library_build_settings(vendored_dynamic_library, xcconfig, pod_target.sandbox.root, include_ld_flags)
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
# Configures the given Xcconfig according to the build settings of the
|
181
|
-
# given Specification.
|
182
|
-
#
|
183
|
-
# @param [Specification::Consumer] consumer
|
184
|
-
# The consumer of the specification.
|
185
|
-
#
|
186
|
-
# @param [Xcodeproj::Config] xcconfig
|
187
|
-
# The xcconfig to edit.
|
188
|
-
#
|
189
|
-
# @return [void]
|
190
|
-
#
|
191
|
-
def self.add_spec_build_settings_to_xcconfig(consumer, xcconfig)
|
192
|
-
xcconfig.libraries.merge(consumer.libraries)
|
193
|
-
xcconfig.frameworks.merge(consumer.frameworks)
|
194
|
-
xcconfig.weak_frameworks.merge(consumer.weak_frameworks)
|
195
|
-
add_developers_frameworks_if_needed(xcconfig)
|
196
|
-
end
|
197
|
-
|
198
|
-
# Configures the given Xcconfig with the build settings for the given
|
199
|
-
# framework path.
|
200
|
-
#
|
201
|
-
# @param [Pathname] framework_path
|
202
|
-
# The path of the framework.
|
203
|
-
#
|
204
|
-
# @param [Xcodeproj::Config] xcconfig
|
205
|
-
# The xcconfig to edit.
|
206
|
-
#
|
207
|
-
# @param [Pathname] sandbox_root
|
208
|
-
# The path retrieved from Sandbox#root.
|
209
|
-
#
|
210
|
-
# @param [Boolean] include_ld_flags
|
211
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
212
|
-
#
|
213
|
-
# @return [void]
|
214
|
-
#
|
215
|
-
def self.add_framework_build_settings(framework_path, xcconfig, sandbox_root, include_ld_flags = true)
|
216
|
-
name = File.basename(framework_path, '.framework')
|
217
|
-
dirname = '${PODS_ROOT}/' + framework_path.dirname.relative_path_from(sandbox_root).to_s
|
218
|
-
build_settings = {
|
219
|
-
'FRAMEWORK_SEARCH_PATHS' => quote([dirname]),
|
220
|
-
}
|
221
|
-
build_settings['OTHER_LDFLAGS'] = "-framework \"#{name}\"" if include_ld_flags
|
222
|
-
xcconfig.merge!(build_settings)
|
223
|
-
end
|
224
|
-
|
225
|
-
# Configures the given Xcconfig with the build settings for the given
|
226
|
-
# library path.
|
227
|
-
#
|
228
|
-
# @param [Pathname] library_path
|
229
|
-
# The path of the library.
|
230
|
-
#
|
231
|
-
# @param [Xcodeproj::Config] xcconfig
|
232
|
-
# The xcconfig to edit.
|
233
|
-
#
|
234
|
-
# @param [Pathname] sandbox_root
|
235
|
-
# The path retrieved from Sandbox#root.
|
236
|
-
#
|
237
|
-
# @param [Boolean] include_ld_flags
|
238
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
239
|
-
#
|
240
|
-
# @return [void]
|
241
|
-
#
|
242
|
-
def self.add_library_build_settings(library_path, xcconfig, sandbox_root, include_ld_flags = true)
|
243
|
-
extension = File.extname(library_path)
|
244
|
-
name = File.basename(library_path, extension).sub(/\Alib/, '')
|
245
|
-
dirname = '${PODS_ROOT}/' + library_path.dirname.relative_path_from(sandbox_root).to_s
|
246
|
-
build_settings = {
|
247
|
-
'LIBRARY_SEARCH_PATHS' => quote([dirname]),
|
248
|
-
}
|
249
|
-
build_settings['OTHER_LDFLAGS'] = "-l\"#{name}\"" if include_ld_flags
|
250
|
-
xcconfig.merge!(build_settings)
|
251
|
-
end
|
252
|
-
|
253
|
-
# Add the code signing settings for generated targets to ensure that
|
254
|
-
# frameworks are correctly signed to be integrated and re-signed when
|
255
|
-
# building the application and embedding the framework
|
256
|
-
#
|
257
|
-
# @param [Target] target
|
258
|
-
# The target.
|
259
|
-
#
|
260
|
-
# @param [Xcodeproj::Config] xcconfig
|
261
|
-
# The xcconfig to edit.
|
262
|
-
#
|
263
|
-
# @return [void]
|
264
|
-
#
|
265
|
-
def self.add_code_signing_settings(target, xcconfig)
|
266
|
-
build_settings = {}
|
267
|
-
if target.platform.to_sym == :osx
|
268
|
-
build_settings['CODE_SIGN_IDENTITY'] = ''
|
269
|
-
end
|
270
|
-
xcconfig.merge!(build_settings)
|
271
|
-
end
|
272
|
-
|
273
|
-
# Checks if the given target requires specific settings and configures
|
274
|
-
# the given Xcconfig.
|
275
|
-
#
|
276
|
-
# @param [Target] target
|
277
|
-
# The target.
|
278
|
-
#
|
279
|
-
# @param [Xcodeproj::Config] xcconfig
|
280
|
-
# The xcconfig to edit.
|
281
|
-
#
|
282
|
-
# @return [void]
|
283
|
-
#
|
284
|
-
def self.add_target_specific_settings(target, xcconfig)
|
285
|
-
if target.requires_frameworks?
|
286
|
-
add_code_signing_settings(target, xcconfig)
|
287
|
-
end
|
288
|
-
add_language_specific_settings(target, xcconfig)
|
289
|
-
end
|
290
|
-
|
291
|
-
# Returns the search paths for frameworks and libraries the given target
|
292
|
-
# depends on, so that it can be correctly built and linked.
|
293
|
-
#
|
294
|
-
# @param [Target] target
|
295
|
-
# The target.
|
296
|
-
#
|
297
|
-
# @param [Array<PodTarget>] dependent_targets
|
298
|
-
# The pod targets the given target depends on.
|
299
|
-
#
|
300
|
-
# @param [Boolean] test_xcconfig
|
301
|
-
# Whether the settings for dependent targets are being generated for a test xcconfig or not.
|
302
|
-
#
|
303
|
-
# @return [Hash<String, String>] the settings
|
304
|
-
#
|
305
|
-
def self.search_paths_for_dependent_targets(target, dependent_targets, test_xcconfig = false)
|
306
|
-
dependent_targets = dependent_targets.select(&:should_build?)
|
307
|
-
|
308
|
-
# Filter out dependent targets that are subsets of another target.
|
309
|
-
subset_targets = []
|
310
|
-
dependent_targets.uniq.combination(2) do |a, b|
|
311
|
-
if (a.specs - b.specs).empty?
|
312
|
-
subset_targets << a
|
313
|
-
elsif (b.specs - a.specs).empty?
|
314
|
-
subset_targets << b
|
315
|
-
end
|
316
|
-
end
|
317
|
-
dependent_targets -= subset_targets
|
318
|
-
|
319
|
-
# Alias build dirs to avoid recursive definitions for pod targets and depending
|
320
|
-
# on build settings which could be overwritten in the user target.
|
321
|
-
build_settings = {
|
322
|
-
BUILD_DIR_VARIABLE[2..-2] => '${BUILD_DIR}',
|
323
|
-
CONFIGURATION_BUILD_DIR_VARIABLE[2..-2] => "#{BUILD_DIR_VARIABLE}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)",
|
324
|
-
}
|
325
|
-
|
326
|
-
# Scope pod targets as long as they are not test targets.
|
327
|
-
if !test_xcconfig && target.respond_to?(:configuration_build_dir)
|
328
|
-
build_settings['CONFIGURATION_BUILD_DIR'] = target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
329
|
-
end
|
330
|
-
|
331
|
-
module_map_files = []
|
332
|
-
unless dependent_targets.empty?
|
333
|
-
framework_search_paths = []
|
334
|
-
library_search_paths = []
|
335
|
-
swift_import_paths = []
|
336
|
-
dependent_targets.each do |dependent_target|
|
337
|
-
if dependent_target.requires_frameworks?
|
338
|
-
framework_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
339
|
-
else
|
340
|
-
library_search_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
|
341
|
-
if dependent_target.defines_module?
|
342
|
-
module_map_file = if dependent_target.uses_swift?
|
343
|
-
# for swift, we have a custom build phase that copies in the module map, appending the .Swift module
|
344
|
-
"${PODS_CONFIGURATION_BUILD_DIR}/#{dependent_target.label}/#{dependent_target.product_module_name}.modulemap"
|
345
|
-
else
|
346
|
-
"${PODS_ROOT}/#{dependent_target.module_map_path.relative_path_from(dependent_target.sandbox.root)}"
|
347
|
-
end
|
348
|
-
module_map_files << %(-fmodule-map-file="#{module_map_file}")
|
349
|
-
swift_import_paths << dependent_target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE) if dependent_target.uses_swift?
|
350
|
-
end
|
351
|
-
end
|
352
|
-
end
|
353
|
-
|
354
|
-
build_settings['FRAMEWORK_SEARCH_PATHS'] = XCConfigHelper.quote(framework_search_paths.uniq)
|
355
|
-
build_settings['LIBRARY_SEARCH_PATHS'] = XCConfigHelper.quote(library_search_paths.uniq)
|
356
|
-
build_settings['SWIFT_INCLUDE_PATHS'] = XCConfigHelper.quote(swift_import_paths.uniq)
|
357
|
-
end
|
358
|
-
|
359
|
-
other_swift_flags = module_map_files.tap(&:uniq!).flat_map { |f| ['-Xcc', f] }
|
360
|
-
if target.is_a?(PodTarget) && !target.requires_frameworks? && target.defines_module? && !test_xcconfig
|
361
|
-
# make it possible for a mixed swift/objc static library to be able to import the objc from within swift
|
362
|
-
other_swift_flags += ['-import-underlying-module', '-Xcc', '-fmodule-map-file="${SRCROOT}/${MODULEMAP_FILE}"']
|
363
|
-
end
|
364
|
-
# unconditionally set these, because of (the possibility of) having to add the pod targets own module map file
|
365
|
-
build_settings['OTHER_CFLAGS'] = module_map_files.join(' ')
|
366
|
-
build_settings['OTHER_SWIFT_FLAGS'] = other_swift_flags.join(' ')
|
367
|
-
|
368
|
-
build_settings
|
369
|
-
end
|
370
|
-
|
371
|
-
# Updates xcconfig with the HEADER_SEARCH_PATHS from the search_paths.
|
372
|
-
#
|
373
|
-
# @param [Target] search_paths_target
|
374
|
-
# The target.
|
375
|
-
#
|
376
|
-
# @param [Xcodeproj::Config] xcconfig
|
377
|
-
# The xcconfig to edit.
|
378
|
-
#
|
379
|
-
def self.propagate_header_search_paths_from_search_paths(search_paths_target, xcconfig)
|
380
|
-
header_search_paths_list = []
|
381
|
-
search_paths_target.pod_targets.each do |target|
|
382
|
-
target.spec_consumers.each do |spec_consumer|
|
383
|
-
paths = spec_consumer.user_target_xcconfig['HEADER_SEARCH_PATHS']
|
384
|
-
header_search_paths_list <<= paths unless paths.nil?
|
385
|
-
end
|
386
|
-
unless header_search_paths_list == []
|
387
|
-
header_search_paths = header_search_paths_list.join(' ')
|
388
|
-
unless header_search_paths.include? '$(inherited)'
|
389
|
-
header_search_paths = '$(inherited) ' + header_search_paths
|
390
|
-
end
|
391
|
-
build_settings = { 'HEADER_SEARCH_PATHS' => header_search_paths }
|
392
|
-
xcconfig.merge!(build_settings)
|
393
|
-
end
|
394
|
-
end
|
395
|
-
end
|
396
|
-
|
397
|
-
# Add custom build settings and required build settings to link to
|
398
|
-
# vendored libraries and frameworks.
|
399
|
-
#
|
400
|
-
# @param [Target] target
|
401
|
-
# The root target, may be nil.
|
402
|
-
#
|
403
|
-
# @param [Array<PodTarget] dep_targets
|
404
|
-
# The dependency targets to add the vendored build settings for.
|
405
|
-
#
|
406
|
-
# @param [Xcodeproj::Config] xcconfig
|
407
|
-
# The xcconfig to edit.
|
408
|
-
#
|
409
|
-
# @param [Boolean] include_ld_flags
|
410
|
-
# Indicates whether or not to generate ld flags in addition to compile flags
|
411
|
-
#
|
412
|
-
# @param [Boolean] test_xcconfig
|
413
|
-
# Indicates whether or not the generated ld flags are for a test xcconfig or not
|
414
|
-
#
|
415
|
-
# @note
|
416
|
-
# In case of generated pod targets, which require frameworks, the
|
417
|
-
# vendored frameworks and libraries are already linked statically
|
418
|
-
# into the framework binary and must not be linked again to the
|
419
|
-
# user target.
|
420
|
-
#
|
421
|
-
def self.generate_vendored_build_settings(target, dep_targets, xcconfig, include_ld_flags = true, test_xcconfig = false)
|
422
|
-
dep_targets.each do |dep_target|
|
423
|
-
unless dep_target.should_build? && dep_target.requires_frameworks? && !dep_target.static_framework?
|
424
|
-
XCConfigHelper.add_settings_for_file_accessors_of_target(target, dep_target, xcconfig, include_ld_flags, test_xcconfig)
|
425
|
-
end
|
426
|
-
end
|
427
|
-
end
|
428
|
-
|
429
|
-
# Ensure to add the default linker run path search paths as they could
|
430
|
-
# be not present due to being historically absent in the project or
|
431
|
-
# target template or just being removed by being superficial when
|
432
|
-
# linking third-party dependencies exclusively statically. This is not
|
433
|
-
# something a project needs specifically for the integration with
|
434
|
-
# CocoaPods, but makes sure that it is self-contained for the given
|
435
|
-
# constraints.
|
436
|
-
#
|
437
|
-
# @param [Target] target
|
438
|
-
# The target, this can be an aggregate target or a pod target.
|
439
|
-
#
|
440
|
-
# @param [Boolean] requires_host_target
|
441
|
-
# If this target requires a host target
|
442
|
-
#
|
443
|
-
# @param [Boolean] test_bundle
|
444
|
-
# Whether this is a test bundle or not. This has an effect when the platform is `osx` and changes
|
445
|
-
# the runtime search paths accordingly.
|
446
|
-
#
|
447
|
-
# @param [Xcodeproj::Config] xcconfig
|
448
|
-
# The xcconfig to edit.
|
449
|
-
#
|
450
|
-
# @return [void]
|
451
|
-
#
|
452
|
-
def self.generate_ld_runpath_search_paths(target, requires_host_target, test_bundle, xcconfig)
|
453
|
-
ld_runpath_search_paths = ['$(inherited)']
|
454
|
-
if target.platform.symbolic_name == :osx
|
455
|
-
ld_runpath_search_paths << "'@executable_path/../Frameworks'"
|
456
|
-
ld_runpath_search_paths << \
|
457
|
-
if test_bundle
|
458
|
-
"'@loader_path/../Frameworks'"
|
459
|
-
else
|
460
|
-
"'@loader_path/Frameworks'"
|
461
|
-
end
|
462
|
-
else
|
463
|
-
ld_runpath_search_paths << [
|
464
|
-
"'@executable_path/Frameworks'",
|
465
|
-
"'@loader_path/Frameworks'",
|
466
|
-
]
|
467
|
-
ld_runpath_search_paths << "'@executable_path/../../Frameworks'" if requires_host_target
|
468
|
-
end
|
469
|
-
xcconfig.merge!('LD_RUNPATH_SEARCH_PATHS' => ld_runpath_search_paths.join(' '))
|
470
|
-
end
|
471
|
-
|
472
|
-
# Add pod target to list of frameworks / libraries that are linked
|
473
|
-
# with the user’s project.
|
474
|
-
#
|
475
|
-
# @param [AggregateTarget] aggregate_target
|
476
|
-
# The aggregate target, may be nil.
|
477
|
-
#
|
478
|
-
# @param [Array<PodTarget] pod_targets
|
479
|
-
# The pod targets to add the vendored build settings for.
|
480
|
-
#
|
481
|
-
# @param [Xcodeproj::Config] xcconfig
|
482
|
-
# The xcconfig to edit.
|
483
|
-
#
|
484
|
-
# @return [void]
|
485
|
-
#
|
486
|
-
def self.generate_other_ld_flags(aggregate_target, pod_targets, xcconfig)
|
487
|
-
# Make sure -framework option gets added for the search paths when static_frameworks are involved.
|
488
|
-
# Otherwise test targets won't link in their primary target's dependencies.
|
489
|
-
unless aggregate_target.nil?
|
490
|
-
dependent_targets = aggregate_target.search_paths_aggregate_targets
|
491
|
-
dependent_targets.each do |dependent_target|
|
492
|
-
if aggregate_target.requires_frameworks? && dependent_target.pod_targets.any?(&:static_framework?)
|
493
|
-
generate_other_ld_flags(dependent_target, dependent_target.pod_targets, xcconfig)
|
494
|
-
end
|
495
|
-
end
|
496
|
-
end
|
497
|
-
other_ld_flags = pod_targets.select(&:should_build?).map do |pod_target|
|
498
|
-
if pod_target.requires_frameworks?
|
499
|
-
%(-framework "#{pod_target.product_basename}")
|
500
|
-
elsif XCConfigHelper.links_dependency?(aggregate_target, pod_target)
|
501
|
-
%(-l "#{pod_target.product_basename}")
|
502
|
-
end
|
503
|
-
end
|
504
|
-
xcconfig.merge!('OTHER_LDFLAGS' => other_ld_flags.compact.join(' '))
|
505
|
-
end
|
506
|
-
|
507
|
-
# Checks if the given target requires language specific settings and
|
508
|
-
# configures the given Xcconfig.
|
509
|
-
#
|
510
|
-
# @param [Target] target
|
511
|
-
# The target.
|
512
|
-
#
|
513
|
-
# @param [Xcodeproj::Config] xcconfig
|
514
|
-
# The xcconfig to edit.
|
515
|
-
#
|
516
|
-
# @return [void]
|
517
|
-
#
|
518
|
-
def self.add_language_specific_settings(target, xcconfig)
|
519
|
-
if target.uses_swift?
|
520
|
-
other_swift_flags = ['$(inherited)', quote(%w(-D COCOAPODS))]
|
521
|
-
other_swift_flags << quote(%w(-suppress-warnings)) if target.try(:inhibit_warnings?)
|
522
|
-
build_settings = { 'OTHER_SWIFT_FLAGS' => other_swift_flags.join(' ') }
|
523
|
-
xcconfig.merge!(build_settings)
|
524
|
-
end
|
525
|
-
end
|
526
|
-
|
527
|
-
# Adds the search paths of the developer frameworks to the specification
|
528
|
-
# if needed. This is done because the `SenTestingKit` requires them and
|
529
|
-
# adding them to each specification which requires it is repetitive and
|
530
|
-
# error prone.
|
531
|
-
#
|
532
|
-
# @param [Xcodeproj::Config] xcconfig
|
533
|
-
# The xcconfig to edit.
|
534
|
-
#
|
535
|
-
# @return [void]
|
536
|
-
#
|
537
|
-
def self.add_developers_frameworks_if_needed(xcconfig)
|
538
|
-
matched_frameworks = xcconfig.frameworks & %w(XCTest SenTestingKit)
|
539
|
-
unless matched_frameworks.empty?
|
540
|
-
search_paths = xcconfig.attributes['FRAMEWORK_SEARCH_PATHS'] ||= ''
|
541
|
-
search_paths_to_add = []
|
542
|
-
search_paths_to_add << '$(inherited)'
|
543
|
-
frameworks_path = '"$(PLATFORM_DIR)/Developer/Library/Frameworks"'
|
544
|
-
search_paths_to_add << frameworks_path
|
545
|
-
search_paths_to_add.each do |search_path|
|
546
|
-
unless search_paths.include?(search_path)
|
547
|
-
search_paths << ' ' unless search_paths.empty?
|
548
|
-
search_paths << search_path
|
549
|
-
end
|
550
|
-
end
|
551
|
-
end
|
552
|
-
end
|
553
|
-
|
554
|
-
#---------------------------------------------------------------------#
|
555
|
-
end
|
556
|
-
end
|
557
|
-
end
|
558
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
module Generator
|
3
|
-
# Generates Xcode configuration files. A configuration file is generated
|
4
|
-
# for each Pod and for each Pod target definition. The aggregates the
|
5
|
-
# configurations of the Pods and define target specific settings.
|
6
|
-
#
|
7
|
-
module XCConfig
|
8
|
-
autoload :AggregateXCConfig, 'cocoapods/generator/xcconfig/aggregate_xcconfig'
|
9
|
-
autoload :PodXCConfig, 'cocoapods/generator/xcconfig/pod_xcconfig'
|
10
|
-
autoload :XCConfigHelper, 'cocoapods/generator/xcconfig/xcconfig_helper'
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|