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,32 +1,113 @@
|
|
1
|
+
require 'cocoapods/target/framework_paths'
|
2
|
+
|
1
3
|
module Pod
|
2
4
|
# Stores the information relative to the target used to cluster the targets
|
3
5
|
# of the single Pods. The client targets will then depend on this one.
|
4
6
|
#
|
5
7
|
class AggregateTarget < Target
|
8
|
+
# Product types where the product's frameworks must be embedded in a host target
|
9
|
+
#
|
10
|
+
EMBED_FRAMEWORKS_IN_HOST_TARGET_TYPES = [:app_extension, :framework, :static_library, :messages_extension, :watch_extension, :xpc_service].freeze
|
11
|
+
|
6
12
|
# @return [TargetDefinition] the target definition of the Podfile that
|
7
13
|
# generated this target.
|
14
|
+
#
|
8
15
|
attr_reader :target_definition
|
9
16
|
|
10
|
-
#
|
17
|
+
# @return [Pathname] the folder where the client is stored used for
|
18
|
+
# computing the relative paths. If integrating it should be the
|
19
|
+
# folder where the user project is stored, otherwise it should
|
20
|
+
# be the installation root.
|
11
21
|
#
|
12
|
-
|
22
|
+
attr_reader :client_root
|
13
23
|
|
14
|
-
#
|
24
|
+
# @return [Xcodeproj::Project] the user project that this target will
|
25
|
+
# integrate as identified by the analyzer.
|
26
|
+
#
|
27
|
+
attr_reader :user_project
|
28
|
+
|
29
|
+
# @return [Array<String>] the list of the UUIDs of the user targets that
|
30
|
+
# will be integrated by this target as identified by the analyzer.
|
31
|
+
#
|
32
|
+
# @note The target instances are not stored to prevent editing different
|
33
|
+
# instances.
|
34
|
+
#
|
35
|
+
attr_reader :user_target_uuids
|
36
|
+
|
37
|
+
# @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
|
38
|
+
# configuration file for the target
|
39
|
+
#
|
40
|
+
# @note The configurations are generated by the {TargetInstaller} and
|
41
|
+
# used by {UserProjectIntegrator} to check for any overridden
|
42
|
+
# values.
|
43
|
+
#
|
44
|
+
attr_reader :xcconfigs
|
45
|
+
|
46
|
+
# @return [Array<PodTarget>] The dependencies for this target.
|
47
|
+
#
|
48
|
+
attr_reader :pod_targets
|
49
|
+
|
50
|
+
# @return [Array<AggregateTarget>] The aggregate targets whose pods this
|
51
|
+
# target must be able to import, but will not directly link against.
|
15
52
|
#
|
16
|
-
|
17
|
-
|
53
|
+
attr_reader :search_paths_aggregate_targets
|
54
|
+
|
55
|
+
# Initialize a new instance
|
18
56
|
#
|
19
|
-
|
20
|
-
|
21
|
-
|
57
|
+
# @param [Sandbox] sandbox @see Target#sandbox
|
58
|
+
# @param [Boolean] host_requires_frameworks @see Target#host_requires_frameworks
|
59
|
+
# @param [Hash{String=>Symbol}] user_build_configurations @see Target#user_build_configurations
|
60
|
+
# @param [Array<String>] archs @see Target#archs
|
61
|
+
# @param [Platform] platform @see #Target#platform
|
62
|
+
# @param [TargetDefinition] target_definition @see #target_definition
|
63
|
+
# @param [Pathname] client_root @see #client_root
|
64
|
+
# @param [Xcodeproj::Project] user_project @see #user_project
|
65
|
+
# @param [Array<String>] user_target_uuids @see #user_target_uuids
|
66
|
+
# @param [Hash{String=>Array<PodTarget>}] pod_targets_for_build_configuration @see #pod_targets_for_build_configuration
|
67
|
+
#
|
68
|
+
def initialize(sandbox, host_requires_frameworks, user_build_configurations, archs, platform, target_definition,
|
69
|
+
client_root, user_project, user_target_uuids, pod_targets_for_build_configuration)
|
70
|
+
super(sandbox, host_requires_frameworks, user_build_configurations, archs, platform)
|
71
|
+
raise "Can't initialize an AggregateTarget without a TargetDefinition!" if target_definition.nil?
|
72
|
+
raise "Can't initialize an AggregateTarget with an abstract TargetDefinition!" if target_definition.abstract?
|
22
73
|
@target_definition = target_definition
|
23
|
-
@
|
24
|
-
@
|
74
|
+
@client_root = client_root
|
75
|
+
@user_project = user_project
|
76
|
+
@user_target_uuids = user_target_uuids
|
77
|
+
@pod_targets_for_build_configuration = pod_targets_for_build_configuration
|
78
|
+
@pod_targets = pod_targets_for_build_configuration.values.flatten.uniq
|
25
79
|
@search_paths_aggregate_targets = []
|
26
|
-
@file_accessors = []
|
27
80
|
@xcconfigs = {}
|
28
81
|
end
|
29
82
|
|
83
|
+
# Merges this aggregate target with additional pod targets that are part of embedded aggregate targets.
|
84
|
+
#
|
85
|
+
# @param [Hash{String=>Array<PodTarget>}] embedded_pod_targets_for_build_configuration
|
86
|
+
# The pod targets to merge with.
|
87
|
+
#
|
88
|
+
# @return [AggregateTarget] a new instance of this aggregate target with additional pod targets to be used from
|
89
|
+
# pod targets of embedded aggregate targets.
|
90
|
+
#
|
91
|
+
def merge_embedded_pod_targets(embedded_pod_targets_for_build_configuration)
|
92
|
+
merged = @pod_targets_for_build_configuration.merge(embedded_pod_targets_for_build_configuration) do |_, before, after|
|
93
|
+
(before + after).uniq
|
94
|
+
end
|
95
|
+
AggregateTarget.new(sandbox, host_requires_frameworks, user_build_configurations, archs, platform,
|
96
|
+
target_definition, client_root, user_project, user_target_uuids, merged).tap do |aggregate_target|
|
97
|
+
aggregate_target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def build_settings(configuration_name = nil)
|
102
|
+
if configuration_name
|
103
|
+
@build_settings[configuration_name] ||
|
104
|
+
raise(ArgumentError, "#{self} does not contain a build setting for the #{configuration_name.inspect} configuration, only #{@build_settings.keys.inspect}")
|
105
|
+
else
|
106
|
+
@build_settings.each_value.first ||
|
107
|
+
raise(ArgumentError, "#{self} does not contain any build settings")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
30
111
|
# @return [Boolean] True if the user_target refers to a
|
31
112
|
# library (framework, static or dynamic lib).
|
32
113
|
#
|
@@ -61,38 +142,12 @@ module Pod
|
|
61
142
|
target_definition.label.to_s
|
62
143
|
end
|
63
144
|
|
64
|
-
# @return [String] the name to use for the source code module constructed
|
65
|
-
# for this target, and which will be used to import the module in
|
66
|
-
# implementation source files.
|
67
|
-
#
|
68
|
-
def product_module_name
|
69
|
-
c99ext_identifier(label)
|
70
|
-
end
|
71
|
-
|
72
|
-
# @return [Platform] the platform for this target.
|
73
|
-
#
|
74
|
-
def platform
|
75
|
-
@platform ||= target_definition.platform
|
76
|
-
end
|
77
|
-
|
78
145
|
# @return [Podfile] The podfile which declares the dependency
|
79
146
|
#
|
80
147
|
def podfile
|
81
148
|
target_definition.podfile
|
82
149
|
end
|
83
150
|
|
84
|
-
# @return [Pathname] the folder where the client is stored used for
|
85
|
-
# computing the relative paths. If integrating it should be the
|
86
|
-
# folder where the user project is stored, otherwise it should
|
87
|
-
# be the installation root.
|
88
|
-
#
|
89
|
-
attr_accessor :client_root
|
90
|
-
|
91
|
-
# @return [Xcodeproj::Project] the user project that this target will
|
92
|
-
# integrate as identified by the analyzer.
|
93
|
-
#
|
94
|
-
attr_accessor :user_project
|
95
|
-
|
96
151
|
# @return [Pathname] the path of the user project that this target will
|
97
152
|
# integrate as identified by the analyzer.
|
98
153
|
#
|
@@ -100,14 +155,6 @@ module Pod
|
|
100
155
|
user_project.path if user_project
|
101
156
|
end
|
102
157
|
|
103
|
-
# @return [Array<String>] the list of the UUIDs of the user targets that
|
104
|
-
# will be integrated by this target as identified by the analyzer.
|
105
|
-
#
|
106
|
-
# @note The target instances are not stored to prevent editing different
|
107
|
-
# instances.
|
108
|
-
#
|
109
|
-
attr_accessor :user_target_uuids
|
110
|
-
|
111
158
|
# List all user targets that will be integrated by this #target.
|
112
159
|
#
|
113
160
|
# @return [Array<PBXNativeTarget>]
|
@@ -124,24 +171,6 @@ module Pod
|
|
124
171
|
end
|
125
172
|
end
|
126
173
|
|
127
|
-
# @return [Hash<String, Xcodeproj::Config>] Map from configuration name to
|
128
|
-
# configuration file for the target
|
129
|
-
#
|
130
|
-
# @note The configurations are generated by the {TargetInstaller} and
|
131
|
-
# used by {UserProjectIntegrator} to check for any overridden
|
132
|
-
# values.
|
133
|
-
#
|
134
|
-
attr_reader :xcconfigs
|
135
|
-
|
136
|
-
# @return [Array<PodTarget>] The dependencies for this target.
|
137
|
-
#
|
138
|
-
attr_accessor :pod_targets
|
139
|
-
|
140
|
-
# @return [Array<AggregateTarget>] The aggregate targets whose pods this
|
141
|
-
# target must be able to import, but will not directly link against.
|
142
|
-
#
|
143
|
-
attr_reader :search_paths_aggregate_targets
|
144
|
-
|
145
174
|
# @param [String] build_configuration The build configuration for which the
|
146
175
|
# the pod targets should be returned.
|
147
176
|
#
|
@@ -149,14 +178,7 @@ module Pod
|
|
149
178
|
# configuration.
|
150
179
|
#
|
151
180
|
def pod_targets_for_build_configuration(build_configuration)
|
152
|
-
@pod_targets_for_build_configuration
|
153
|
-
@pod_targets_for_build_configuration[build_configuration] ||= pod_targets.select do |pod_target|
|
154
|
-
pod_target.include_in_build_config?(target_definition, build_configuration)
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
|
-
def pod_targets_to_link
|
159
|
-
@pod_targets_to_link ||= pod_targets.to_set - search_paths_aggregate_targets.flat_map(&:pod_targets)
|
181
|
+
@pod_targets_for_build_configuration[build_configuration] || []
|
160
182
|
end
|
161
183
|
|
162
184
|
# @return [Array<Specification>] The specifications used by this aggregate target.
|
@@ -189,7 +211,20 @@ module Pod
|
|
189
211
|
pod_targets.any?(&:uses_swift?)
|
190
212
|
end
|
191
213
|
|
192
|
-
# @return [
|
214
|
+
# @return [Boolean] Whether the target contains any resources
|
215
|
+
#
|
216
|
+
def includes_resources?
|
217
|
+
!resource_paths_by_config.values.all?(&:empty?)
|
218
|
+
end
|
219
|
+
|
220
|
+
# @return [Boolean] Whether the target contains framework to be embedded into
|
221
|
+
# the user target
|
222
|
+
#
|
223
|
+
def includes_frameworks?
|
224
|
+
!framework_paths_by_config.values.all?(&:empty?)
|
225
|
+
end
|
226
|
+
|
227
|
+
# @return [Hash{String => Array<FrameworkPaths>}] The vendored dynamic artifacts and framework target
|
193
228
|
# input and output paths grouped by config
|
194
229
|
#
|
195
230
|
def framework_paths_by_config
|
@@ -197,7 +232,10 @@ module Pod
|
|
197
232
|
framework_paths_by_config = {}
|
198
233
|
user_build_configurations.keys.each do |config|
|
199
234
|
relevant_pod_targets = pod_targets_for_build_configuration(config)
|
200
|
-
framework_paths_by_config[config] = relevant_pod_targets.flat_map
|
235
|
+
framework_paths_by_config[config] = relevant_pod_targets.flat_map do |pod_target|
|
236
|
+
non_test_specs = pod_target.non_test_specs.map(&:name)
|
237
|
+
pod_target.framework_paths.values_at(*non_test_specs).flatten.compact.uniq
|
238
|
+
end
|
201
239
|
end
|
202
240
|
framework_paths_by_config
|
203
241
|
end
|
@@ -211,8 +249,12 @@ module Pod
|
|
211
249
|
pod_target.should_build? && pod_target.requires_frameworks? && !pod_target.static_framework?
|
212
250
|
end
|
213
251
|
user_build_configurations.keys.each_with_object({}) do |config, resources_by_config|
|
214
|
-
|
215
|
-
|
252
|
+
targets = relevant_pod_targets & pod_targets_for_build_configuration(config)
|
253
|
+
resources_by_config[config] = targets.flat_map do |pod_target|
|
254
|
+
non_test_specs = pod_target.non_test_specs.map(&:name)
|
255
|
+
resource_paths = pod_target.resource_paths.values_at(*non_test_specs).flatten
|
256
|
+
resource_paths << bridge_support_file
|
257
|
+
resource_paths.compact.uniq
|
216
258
|
end
|
217
259
|
end
|
218
260
|
end
|
@@ -256,11 +298,17 @@ module Pod
|
|
256
298
|
"$(DERIVED_FILE_DIR)/#{label}-checkManifestLockResult.txt"
|
257
299
|
end
|
258
300
|
|
301
|
+
# @return [Pathname] The relative path of the Pods directory from user project's directory.
|
302
|
+
#
|
303
|
+
def relative_pods_root_path
|
304
|
+
sandbox.root.relative_path_from(client_root)
|
305
|
+
end
|
306
|
+
|
259
307
|
# @return [String] The xcconfig path of the root from the `$(SRCROOT)`
|
260
308
|
# variable of the user's project.
|
261
309
|
#
|
262
310
|
def relative_pods_root
|
263
|
-
"${SRCROOT}/#{
|
311
|
+
"${SRCROOT}/#{relative_pods_root_path}"
|
264
312
|
end
|
265
313
|
|
266
314
|
# @return [String] The path of the Podfile directory relative to the
|
@@ -278,21 +326,21 @@ module Pod
|
|
278
326
|
# the user project.
|
279
327
|
#
|
280
328
|
def xcconfig_relative_path(config_name)
|
281
|
-
|
329
|
+
xcconfig_path(config_name).relative_path_from(client_root).to_s
|
282
330
|
end
|
283
331
|
|
284
332
|
# @return [String] The path of the copy resources script relative to the
|
285
|
-
# root of the
|
333
|
+
# root of the Pods project.
|
286
334
|
#
|
287
335
|
def copy_resources_script_relative_path
|
288
|
-
"${
|
336
|
+
"${PODS_ROOT}/#{relative_to_pods_root(copy_resources_script_path)}"
|
289
337
|
end
|
290
338
|
|
291
339
|
# @return [String] The path of the embed frameworks relative to the
|
292
|
-
# root of the
|
340
|
+
# root of the Pods project.
|
293
341
|
#
|
294
342
|
def embed_frameworks_script_relative_path
|
295
|
-
"${
|
343
|
+
"${PODS_ROOT}/#{relative_to_pods_root(embed_frameworks_script_path)}"
|
296
344
|
end
|
297
345
|
|
298
346
|
private
|
@@ -300,16 +348,26 @@ module Pod
|
|
300
348
|
# @!group Private Helpers
|
301
349
|
#-------------------------------------------------------------------------#
|
302
350
|
|
303
|
-
# Computes the relative path of a sandboxed file from the `$(
|
304
|
-
# variable of the
|
351
|
+
# Computes the relative path of a sandboxed file from the `$(PODS_ROOT)`
|
352
|
+
# variable of the Pods's project.
|
305
353
|
#
|
306
354
|
# @param [Pathname] path
|
307
355
|
# A relative path from the root of the sandbox.
|
308
356
|
#
|
309
357
|
# @return [String] The computed path.
|
310
358
|
#
|
311
|
-
def
|
312
|
-
path.relative_path_from(
|
359
|
+
def relative_to_pods_root(path)
|
360
|
+
path.relative_path_from(sandbox.root).to_s
|
361
|
+
end
|
362
|
+
|
363
|
+
def create_build_settings
|
364
|
+
settings = {}
|
365
|
+
|
366
|
+
user_build_configurations.each_key do |configuration_name|
|
367
|
+
settings[configuration_name] = BuildSettings::AggregateTargetSettings.new(self, configuration_name)
|
368
|
+
end
|
369
|
+
|
370
|
+
settings
|
313
371
|
end
|
314
372
|
end
|
315
373
|
end
|