cocoapods 0.33.1 → 0.34.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +171 -46
- data/README.md +9 -9
- data/bin/pod +5 -5
- data/bin/sandbox-pod +2 -6
- data/lib/cocoapods.rb +4 -4
- data/lib/cocoapods/command.rb +12 -10
- data/lib/cocoapods/command/init.rb +12 -13
- data/lib/cocoapods/command/inter_process_communication.rb +6 -17
- data/lib/cocoapods/command/lib.rb +27 -24
- data/lib/cocoapods/command/list.rb +9 -9
- data/lib/cocoapods/command/outdated.rb +4 -9
- data/lib/cocoapods/command/project.rb +57 -19
- data/lib/cocoapods/command/push.rb +0 -1
- data/lib/cocoapods/command/repo.rb +14 -15
- data/lib/cocoapods/command/repo/push.rb +24 -19
- data/lib/cocoapods/command/search.rb +12 -13
- data/lib/cocoapods/command/setup.rb +10 -9
- data/lib/cocoapods/command/spec.rb +67 -63
- data/lib/cocoapods/config.rb +21 -54
- data/lib/cocoapods/downloader.rb +0 -1
- data/lib/cocoapods/executable.rb +3 -8
- data/lib/cocoapods/external_sources.rb +2 -4
- data/lib/cocoapods/external_sources/abstract_external_source.rb +15 -10
- data/lib/cocoapods/external_sources/downloader_source.rb +0 -2
- data/lib/cocoapods/external_sources/path_source.rb +1 -4
- data/lib/cocoapods/external_sources/podspec_source.rb +1 -3
- data/lib/cocoapods/gem_version.rb +1 -2
- data/lib/cocoapods/generator/acknowledgements.rb +5 -8
- data/lib/cocoapods/generator/acknowledgements/markdown.rb +5 -7
- data/lib/cocoapods/generator/acknowledgements/plist.rb +9 -10
- data/lib/cocoapods/generator/bridge_support.rb +1 -1
- data/lib/cocoapods/generator/copy_resources_script.rb +10 -14
- data/lib/cocoapods/generator/dummy_source.rb +3 -3
- data/lib/cocoapods/generator/prefix_header.rb +15 -16
- data/lib/cocoapods/generator/target_environment_header.rb +122 -36
- data/lib/cocoapods/generator/xcconfig.rb +0 -4
- data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +74 -65
- data/lib/cocoapods/generator/xcconfig/private_pod_xcconfig.rb +92 -95
- data/lib/cocoapods/generator/xcconfig/public_pod_xcconfig.rb +48 -51
- data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +10 -10
- data/lib/cocoapods/hooks/installer_representation.rb +15 -18
- data/lib/cocoapods/hooks/library_representation.rb +4 -8
- data/lib/cocoapods/hooks/pod_representation.rb +1 -5
- data/lib/cocoapods/hooks_manager.rb +63 -0
- data/lib/cocoapods/installer.rb +60 -47
- data/lib/cocoapods/installer/analyzer.rb +60 -62
- data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +5 -8
- data/lib/cocoapods/installer/file_references_installer.rb +7 -10
- data/lib/cocoapods/installer/hooks_context.rb +74 -0
- data/lib/cocoapods/installer/migrator.rb +99 -0
- data/lib/cocoapods/installer/pod_source_installer.rb +9 -29
- data/lib/cocoapods/installer/target_installer.rb +7 -17
- data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +40 -41
- data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +43 -54
- data/lib/cocoapods/installer/user_project_integrator.rb +54 -10
- data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +66 -117
- data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +116 -0
- data/lib/cocoapods/open_uri.rb +1 -2
- data/lib/cocoapods/project.rb +34 -8
- data/lib/cocoapods/resolver.rb +43 -21
- data/lib/cocoapods/sandbox.rb +80 -75
- data/lib/cocoapods/sandbox/file_accessor.rb +3 -8
- data/lib/cocoapods/sandbox/headers_store.rb +6 -7
- data/lib/cocoapods/sandbox/path_list.rb +7 -10
- data/lib/cocoapods/sources_manager.rb +81 -49
- data/lib/cocoapods/target.rb +18 -12
- data/lib/cocoapods/target/aggregate_target.rb +43 -18
- data/lib/cocoapods/target/pod_target.rb +37 -4
- data/lib/cocoapods/user_interface.rb +19 -18
- data/lib/cocoapods/user_interface/error_report.rb +23 -4
- data/lib/cocoapods/validator.rb +30 -33
- metadata +100 -73
- data/lib/cocoapods/command/help.rb +0 -25
@@ -1,7 +1,6 @@
|
|
1
1
|
module Pod
|
2
2
|
module Hooks
|
3
3
|
class LibraryRepresentation
|
4
|
-
|
5
4
|
# Stores the information of the target installer
|
6
5
|
|
7
6
|
#-----------------------------------------------------------------------#
|
@@ -27,11 +26,11 @@ module Pod
|
|
27
26
|
# @return [Pathname] The path of the prefix_header
|
28
27
|
#
|
29
28
|
def prefix_header_path
|
30
|
-
UI.warn
|
31
|
-
|
29
|
+
UI.warn 'LibraryRepresentation#prefix_header_path is deprecated. ' \
|
30
|
+
'Use the specification `prefix_header_contents` attribute.'
|
32
31
|
library.prefix_header_path
|
33
32
|
end
|
34
|
-
|
33
|
+
alias_method :prefix_header_filename, :prefix_header_path
|
35
34
|
|
36
35
|
# @return [Pathname] The path of the script used to copy the resources.
|
37
36
|
#
|
@@ -83,13 +82,10 @@ module Pod
|
|
83
82
|
def initialize(sandbox, library)
|
84
83
|
@sandbox = sandbox
|
85
84
|
@library = library
|
86
|
-
raise
|
85
|
+
raise '[BUG]' unless library.is_a?(AggregateTarget)
|
87
86
|
end
|
88
87
|
|
89
88
|
#-----------------------------------------------------------------------#
|
90
|
-
|
91
89
|
end
|
92
90
|
end
|
93
91
|
end
|
94
|
-
|
95
|
-
|
@@ -1,19 +1,16 @@
|
|
1
1
|
module Pod
|
2
|
-
|
3
2
|
class Specification
|
4
3
|
def config
|
5
4
|
UI.warn "[#{name}] Specification#config is deprecated. The config is accessible from " \
|
6
|
-
|
5
|
+
'the parameter passed to the hooks'
|
7
6
|
Config.instance
|
8
7
|
end
|
9
8
|
end
|
10
9
|
|
11
10
|
module Hooks
|
12
|
-
|
13
11
|
# Stores the information of the Installer for the hooks
|
14
12
|
#
|
15
13
|
class PodRepresentation
|
16
|
-
|
17
14
|
# @return [String]
|
18
15
|
#
|
19
16
|
attr_accessor :name
|
@@ -68,7 +65,6 @@ module Pod
|
|
68
65
|
attr_reader :file_accessors
|
69
66
|
|
70
67
|
#-----------------------------------------------------------------------#
|
71
|
-
|
72
68
|
end
|
73
69
|
end
|
74
70
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Pod
|
2
|
+
# Provides support for the hook system of CocoaPods. The system is designed
|
3
|
+
# especially for plugins. Interested clients can register to notifications by
|
4
|
+
# name.
|
5
|
+
#
|
6
|
+
# The blocks, to prevent compatibility issues, will receive
|
7
|
+
# one and only one argument: a context object. This object should be simple
|
8
|
+
# storage of information (a typed hash). Notifications senders are
|
9
|
+
# responsible to indicate the class of the object associated with their
|
10
|
+
# notification name.
|
11
|
+
#
|
12
|
+
# Context object should not remove attribute accessors to not break
|
13
|
+
# compatibility with the plugins (this promise will be honoured strictly
|
14
|
+
# from CocoaPods 1.0).
|
15
|
+
#
|
16
|
+
module HooksManager
|
17
|
+
class << self
|
18
|
+
# @return [Hash{Symbol => Proc}] The list of the blocks that are
|
19
|
+
# registered for each notification name.
|
20
|
+
#
|
21
|
+
attr_reader :registrations
|
22
|
+
|
23
|
+
# Registers a block for the hook with the given name.
|
24
|
+
#
|
25
|
+
# @param [Symbol] name
|
26
|
+
# The name of the notification.
|
27
|
+
#
|
28
|
+
# @param [Proc] block
|
29
|
+
# The block.
|
30
|
+
#
|
31
|
+
def register(name, &block)
|
32
|
+
raise ArgumentError, 'Missing name' unless name
|
33
|
+
raise ArgumentError, 'Missing block' unless block
|
34
|
+
|
35
|
+
@registrations ||= {}
|
36
|
+
@registrations[name] ||= []
|
37
|
+
@registrations[name] << block
|
38
|
+
end
|
39
|
+
|
40
|
+
# Runs all the registered blocks for the hook with the given name.
|
41
|
+
#
|
42
|
+
# @param [Symbol] name
|
43
|
+
# The name of the hook.
|
44
|
+
#
|
45
|
+
# @param [Object] context
|
46
|
+
# The context object which should be passed to the blocks.
|
47
|
+
#
|
48
|
+
def run(name, context)
|
49
|
+
raise ArgumentError, 'Missing name' unless name
|
50
|
+
raise ArgumentError, 'Missing options' unless context
|
51
|
+
|
52
|
+
if @registrations
|
53
|
+
blocks = @registrations[name]
|
54
|
+
if blocks
|
55
|
+
blocks.each do |block|
|
56
|
+
block.call(context)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/cocoapods/installer.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'active_support/core_ext/string/inflections'
|
2
2
|
|
3
3
|
module Pod
|
4
|
-
|
5
4
|
# The Installer is responsible of taking a Podfile and transform it in the
|
6
5
|
# Pods libraries. It also integrates the user project so the Pods
|
7
6
|
# libraries can be used out of the box.
|
@@ -29,13 +28,14 @@ module Pod
|
|
29
28
|
# source control.
|
30
29
|
#
|
31
30
|
class Installer
|
32
|
-
|
31
|
+
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
|
33
32
|
autoload :Analyzer, 'cocoapods/installer/analyzer'
|
34
33
|
autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
|
34
|
+
autoload :HooksContext, 'cocoapods/installer/hooks_context'
|
35
|
+
autoload :Migrator, 'cocoapods/installer/migrator'
|
35
36
|
autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
|
36
|
-
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
|
37
|
-
autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
|
38
37
|
autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer'
|
38
|
+
autoload :TargetInstaller, 'cocoapods/installer/target_installer'
|
39
39
|
autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
|
40
40
|
|
41
41
|
include Config::Mixin
|
@@ -73,7 +73,7 @@ module Pod
|
|
73
73
|
|
74
74
|
# Installs the Pods.
|
75
75
|
#
|
76
|
-
# The installation process
|
76
|
+
# The installation process is mostly linear with a few minor complications
|
77
77
|
# to keep in mind:
|
78
78
|
#
|
79
79
|
# - The stored podspecs need to be cleaned before the resolution step
|
@@ -86,6 +86,7 @@ module Pod
|
|
86
86
|
# @return [void]
|
87
87
|
#
|
88
88
|
def install!
|
89
|
+
prepare
|
89
90
|
resolve_dependencies
|
90
91
|
download_dependencies
|
91
92
|
generate_pods_project
|
@@ -93,16 +94,24 @@ module Pod
|
|
93
94
|
perform_post_install_actions
|
94
95
|
end
|
95
96
|
|
97
|
+
def prepare
|
98
|
+
UI.section 'Preparing' do
|
99
|
+
sandbox.prepare
|
100
|
+
Migrator.migrate(sandbox)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
96
104
|
def resolve_dependencies
|
97
|
-
UI.section
|
105
|
+
UI.section 'Analyzing dependencies' do
|
98
106
|
analyze
|
107
|
+
validate_build_configurations
|
99
108
|
prepare_for_legacy_compatibility
|
100
109
|
clean_sandbox
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
104
113
|
def download_dependencies
|
105
|
-
UI.section
|
114
|
+
UI.section 'Downloading dependencies' do
|
106
115
|
create_file_accessors
|
107
116
|
install_pod_sources
|
108
117
|
run_pre_install_hooks
|
@@ -111,13 +120,12 @@ module Pod
|
|
111
120
|
end
|
112
121
|
|
113
122
|
def generate_pods_project
|
114
|
-
UI.section
|
123
|
+
UI.section 'Generating Pods project' do
|
115
124
|
prepare_pods_project
|
116
125
|
install_file_references
|
117
126
|
install_libraries
|
118
127
|
set_target_dependencies
|
119
|
-
|
120
|
-
run_post_install_hooks
|
128
|
+
run_podfile_post_install_hooks
|
121
129
|
write_pod_project
|
122
130
|
write_lockfiles
|
123
131
|
end
|
@@ -177,6 +185,23 @@ module Pod
|
|
177
185
|
@aggregate_targets = analyzer.result.targets
|
178
186
|
end
|
179
187
|
|
188
|
+
# Ensures that the white-listed build configurations are known to prevent
|
189
|
+
# silent typos.
|
190
|
+
#
|
191
|
+
# @raise If a unknown user configuration is found.
|
192
|
+
#
|
193
|
+
def validate_build_configurations
|
194
|
+
whitelisted_configs = pod_targets.map do |target|
|
195
|
+
target.target_definition.all_whitelisted_configurations.map(&:downcase)
|
196
|
+
end.flatten.uniq
|
197
|
+
all_user_configurations = analysis_result.all_user_build_configurations.keys.map(&:downcase)
|
198
|
+
|
199
|
+
remainder = whitelisted_configs - all_user_configurations
|
200
|
+
unless remainder.empty?
|
201
|
+
raise Informative, "Unknown #{'configuration'.pluralize(remainder.size)} whitelisted: #{remainder.sort.to_sentence}."
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
180
205
|
# Prepares the Pods folder in order to be compatible with the most recent
|
181
206
|
# version of CocoaPods.
|
182
207
|
#
|
@@ -201,7 +226,7 @@ module Pod
|
|
201
226
|
end
|
202
227
|
|
203
228
|
unless sandbox_state.deleted.empty?
|
204
|
-
title_options = { :verbose_prefix =>
|
229
|
+
title_options = { :verbose_prefix => '-> '.red }
|
205
230
|
sandbox_state.deleted.each do |pod_name|
|
206
231
|
UI.titled_section("Removing #{pod_name}".red, title_options) do
|
207
232
|
sandbox.clean_pod(pod_name)
|
@@ -235,7 +260,7 @@ module Pod
|
|
235
260
|
def install_pod_sources
|
236
261
|
@installed_specs = []
|
237
262
|
pods_to_install = sandbox_state.added | sandbox_state.changed
|
238
|
-
title_options = { :verbose_prefix =>
|
263
|
+
title_options = { :verbose_prefix => '-> '.green }
|
239
264
|
root_specs.sort_by(&:name).each do |spec|
|
240
265
|
if pods_to_install.include?(spec.name)
|
241
266
|
if sandbox_state.changed.include?(spec.name) && sandbox.manifest
|
@@ -270,7 +295,6 @@ module Pod
|
|
270
295
|
|
271
296
|
@pod_installers ||= []
|
272
297
|
pod_installer = PodSourceInstaller.new(sandbox, specs_by_platform)
|
273
|
-
pod_installer.aggressive_cache = config.aggressive_cache?
|
274
298
|
pod_installer.install!
|
275
299
|
@pod_installers << pod_installer
|
276
300
|
@installed_specs.concat(specs_by_platform.values.flatten.uniq)
|
@@ -283,9 +307,7 @@ module Pod
|
|
283
307
|
def clean_pod_sources
|
284
308
|
return unless config.clean?
|
285
309
|
return unless @pod_installers
|
286
|
-
@pod_installers.each
|
287
|
-
pod_installer.clean!
|
288
|
-
end
|
310
|
+
@pod_installers.each(&:clean!)
|
289
311
|
end
|
290
312
|
|
291
313
|
# Performs any post-installation actions
|
@@ -293,9 +315,17 @@ module Pod
|
|
293
315
|
# @return [void]
|
294
316
|
#
|
295
317
|
def perform_post_install_actions
|
318
|
+
run_plugins_post_install_hooks
|
296
319
|
warn_for_deprecations
|
297
320
|
end
|
298
321
|
|
322
|
+
# Runs the registered callbacks for the plugins post install hooks.
|
323
|
+
#
|
324
|
+
def run_plugins_post_install_hooks
|
325
|
+
context = HooksContext.generate(sandbox, aggregate_targets)
|
326
|
+
HooksManager.run(:post_install, context)
|
327
|
+
end
|
328
|
+
|
299
329
|
# Prints a warning for any pods that are deprecated
|
300
330
|
#
|
301
331
|
# @return [void]
|
@@ -321,7 +351,7 @@ module Pod
|
|
321
351
|
# @todo Clean and modify the project if it exists.
|
322
352
|
#
|
323
353
|
def prepare_pods_project
|
324
|
-
UI.message
|
354
|
+
UI.message '- Creating Pods project' do
|
325
355
|
@pods_project = Pod::Project.new(sandbox.project_path)
|
326
356
|
|
327
357
|
analysis_result.all_user_build_configurations.each do |name, type|
|
@@ -353,7 +383,6 @@ module Pod
|
|
353
383
|
end
|
354
384
|
end
|
355
385
|
|
356
|
-
|
357
386
|
# Installs the file references in the Pods project. This is done once per
|
358
387
|
# Pod as the same file reference might be shared by multiple aggregate
|
359
388
|
# targets.
|
@@ -371,7 +400,7 @@ module Pod
|
|
371
400
|
# @return [void]
|
372
401
|
#
|
373
402
|
def install_libraries
|
374
|
-
UI.message
|
403
|
+
UI.message '- Installing targets' do
|
375
404
|
pod_targets.sort_by(&:name).each do |pod_target|
|
376
405
|
next if pod_target.target_definition.empty?
|
377
406
|
target_installer = PodTargetInstaller.new(sandbox, pod_target)
|
@@ -415,21 +444,6 @@ module Pod
|
|
415
444
|
end
|
416
445
|
end
|
417
446
|
|
418
|
-
# Links the aggregate targets with all the dependent libraries.
|
419
|
-
#
|
420
|
-
# @note This is run in the integration step to ensure that targets
|
421
|
-
# have been created for all per spec libraries.
|
422
|
-
#
|
423
|
-
def link_aggregate_target
|
424
|
-
aggregate_targets.each do |aggregate_target|
|
425
|
-
native_target = aggregate_target.target
|
426
|
-
aggregate_target.pod_targets.each do |pod_target|
|
427
|
-
product = pod_target.target.product_reference
|
428
|
-
native_target.frameworks_build_phase.add_file_reference(product)
|
429
|
-
end
|
430
|
-
end
|
431
|
-
end
|
432
|
-
|
433
447
|
# Writes the Pods project to the disk.
|
434
448
|
#
|
435
449
|
# @return [void]
|
@@ -438,7 +452,7 @@ module Pod
|
|
438
452
|
UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
|
439
453
|
pods_project.pods.remove_from_project if pods_project.pods.empty?
|
440
454
|
pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
|
441
|
-
pods_project.sort(
|
455
|
+
pods_project.sort(:groups_position => :below)
|
442
456
|
pods_project.recreate_user_schemes(false)
|
443
457
|
pods_project.save
|
444
458
|
end
|
@@ -494,9 +508,9 @@ module Pod
|
|
494
508
|
# @return [void]
|
495
509
|
#
|
496
510
|
def run_pre_install_hooks
|
497
|
-
UI.message
|
511
|
+
UI.message '- Running pre install hooks' do
|
498
512
|
executed = run_podfile_pre_install_hook
|
499
|
-
UI.message
|
513
|
+
UI.message '- Podfile' if executed
|
500
514
|
end
|
501
515
|
end
|
502
516
|
|
@@ -509,8 +523,8 @@ module Pod
|
|
509
523
|
def run_podfile_pre_install_hook
|
510
524
|
podfile.pre_install!(installer_rep)
|
511
525
|
rescue => e
|
512
|
-
raise Informative,
|
513
|
-
|
526
|
+
raise Informative, 'An error occurred while processing the pre-install ' \
|
527
|
+
'hook of the Podfile.' \
|
514
528
|
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
|
515
529
|
end
|
516
530
|
|
@@ -521,10 +535,10 @@ module Pod
|
|
521
535
|
#
|
522
536
|
# @return [void]
|
523
537
|
#
|
524
|
-
def
|
525
|
-
UI.message
|
538
|
+
def run_podfile_post_install_hooks
|
539
|
+
UI.message '- Running post install hooks' do
|
526
540
|
executed = run_podfile_post_install_hook
|
527
|
-
UI.message
|
541
|
+
UI.message '- Podfile' if executed
|
528
542
|
end
|
529
543
|
end
|
530
544
|
|
@@ -537,8 +551,8 @@ module Pod
|
|
537
551
|
def run_podfile_post_install_hook
|
538
552
|
podfile.post_install!(installer_rep)
|
539
553
|
rescue => e
|
540
|
-
raise Informative,
|
541
|
-
|
554
|
+
raise Informative, 'An error occurred while processing the post-install ' \
|
555
|
+
'hook of the Podfile.' \
|
542
556
|
"\n\n#{e.message}\n\n#{e.backtrace * "\n"}"
|
543
557
|
end
|
544
558
|
|
@@ -582,7 +596,7 @@ module Pod
|
|
582
596
|
# @return [Array<PodRepresentation>]
|
583
597
|
#
|
584
598
|
def pod_reps
|
585
|
-
root_specs.sort_by
|
599
|
+
root_specs.sort_by(&:name).map { |spec| pod_rep(spec.name) }
|
586
600
|
end
|
587
601
|
|
588
602
|
# Returns the libraries which use the given specification.
|
@@ -615,7 +629,7 @@ module Pod
|
|
615
629
|
# installation.
|
616
630
|
#
|
617
631
|
def root_specs
|
618
|
-
analysis_result.specifications.map
|
632
|
+
analysis_result.specifications.map(&:root).uniq
|
619
633
|
end
|
620
634
|
|
621
635
|
# @return [SpecsState] The state of the sandbox returned by the analyzer.
|
@@ -625,6 +639,5 @@ module Pod
|
|
625
639
|
end
|
626
640
|
|
627
641
|
#-------------------------------------------------------------------------#
|
628
|
-
|
629
642
|
end
|
630
643
|
end
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module Pod
|
2
2
|
class Installer
|
3
|
-
|
4
3
|
# Analyzes the Podfile, the Lockfile, and the sandbox manifest to generate
|
5
4
|
# the information relative to a CocoaPods installation.
|
6
5
|
#
|
7
6
|
class Analyzer
|
8
|
-
|
9
7
|
include Config::Mixin
|
10
8
|
|
11
9
|
autoload :SandboxAnalyzer, 'cocoapods/installer/analyzer/sandbox_analyzer'
|
@@ -49,10 +47,10 @@ module Pod
|
|
49
47
|
def analyze(allow_fetches = true)
|
50
48
|
update_repositories_if_needed if allow_fetches
|
51
49
|
@result = AnalysisResult.new
|
50
|
+
compute_target_platforms
|
52
51
|
@result.podfile_state = generate_podfile_state
|
53
52
|
@locked_dependencies = generate_version_locking_dependencies
|
54
53
|
|
55
|
-
compute_target_platforms
|
56
54
|
fetch_external_sources if allow_fetches
|
57
55
|
@result.specs_by_target = resolve_dependencies
|
58
56
|
@result.specifications = generate_specifications
|
@@ -111,7 +109,7 @@ module Pod
|
|
111
109
|
:none
|
112
110
|
elsif update == true
|
113
111
|
:all
|
114
|
-
elsif update[:pods]
|
112
|
+
elsif !update[:pods].nil?
|
115
113
|
:selected
|
116
114
|
end
|
117
115
|
end
|
@@ -125,7 +123,7 @@ module Pod
|
|
125
123
|
# modification of the sandbox in the resolution process.
|
126
124
|
#
|
127
125
|
attr_accessor :allow_pre_downloads
|
128
|
-
alias_method
|
126
|
+
alias_method :allow_pre_downloads?, :allow_pre_downloads
|
129
127
|
|
130
128
|
#-----------------------------------------------------------------------#
|
131
129
|
|
@@ -149,10 +147,11 @@ module Pod
|
|
149
147
|
def generate_podfile_state
|
150
148
|
if lockfile
|
151
149
|
pods_state = nil
|
152
|
-
UI.section
|
150
|
+
UI.section 'Finding Podfile changes' do
|
153
151
|
pods_by_state = lockfile.detect_changes_with_podfile(podfile)
|
154
152
|
pods_by_state.dup.each do |state, full_names|
|
155
|
-
|
153
|
+
pods = full_names.map { |fn| Specification.root_name(fn) }.uniq
|
154
|
+
pods_by_state[state] = pods
|
156
155
|
end
|
157
156
|
pods_state = SpecsState.new(pods_by_state)
|
158
157
|
pods_state.print
|
@@ -167,8 +166,6 @@ module Pod
|
|
167
166
|
|
168
167
|
# Updates the source repositories unless the config indicates to skip it.
|
169
168
|
#
|
170
|
-
# @return [void]
|
171
|
-
#
|
172
169
|
def update_repositories_if_needed
|
173
170
|
unless config.skip_repo_update?
|
174
171
|
UI.section 'Updating spec repositories' do
|
@@ -200,7 +197,7 @@ module Pod
|
|
200
197
|
else
|
201
198
|
target.client_root = config.installation_root
|
202
199
|
target.user_target_uuids = []
|
203
|
-
target.user_build_configurations = {}
|
200
|
+
target.user_build_configurations = target_definition.build_configurations || {}
|
204
201
|
if target_definition.platform.name == :osx
|
205
202
|
target.archs = '$(ARCHS_STANDARD_64_BIT)'
|
206
203
|
end
|
@@ -212,15 +209,15 @@ module Pod
|
|
212
209
|
|
213
210
|
grouped_specs.each do |pod_specs|
|
214
211
|
pod_target = PodTarget.new(pod_specs, target_definition, sandbox)
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
212
|
+
if config.integrate_targets?
|
213
|
+
pod_target.user_build_configurations = target.user_build_configurations
|
214
|
+
pod_target.archs = @archs_by_target_def[target_definition]
|
215
|
+
else
|
216
|
+
pod_target.user_build_configurations = {}
|
217
|
+
if target_definition.platform.name == :osx
|
218
|
+
pod_target.archs = '$(ARCHS_STANDARD_64_BIT)'
|
219
|
+
end
|
222
220
|
end
|
223
|
-
end
|
224
221
|
target.pod_targets << pod_target
|
225
222
|
end
|
226
223
|
end
|
@@ -247,8 +244,8 @@ module Pod
|
|
247
244
|
locking_pods = locking_pods.select { |pod| !update[:pods].include?(pod) }
|
248
245
|
end
|
249
246
|
locking_pods.map do |pod|
|
250
|
-
lockfile.
|
251
|
-
end
|
247
|
+
lockfile.dependencies_to_lock_pod_named(pod)
|
248
|
+
end.flatten
|
252
249
|
end
|
253
250
|
end
|
254
251
|
|
@@ -275,7 +272,7 @@ module Pod
|
|
275
272
|
return unless allow_pre_downloads?
|
276
273
|
deps_to_fetch = []
|
277
274
|
deps_to_fetch_if_needed = []
|
278
|
-
deps_with_external_source = podfile.dependencies.select
|
275
|
+
deps_with_external_source = podfile.dependencies.select(&:external_source)
|
279
276
|
|
280
277
|
if update_mode == :all
|
281
278
|
deps_to_fetch = deps_with_external_source
|
@@ -290,7 +287,7 @@ module Pod
|
|
290
287
|
end
|
291
288
|
|
292
289
|
unless deps_to_fetch.empty?
|
293
|
-
UI.section
|
290
|
+
UI.section 'Fetching external sources' do
|
294
291
|
deps_to_fetch.uniq.sort.each do |dependency|
|
295
292
|
source = ExternalSources.from_dependency(dependency, podfile.defined_in_file)
|
296
293
|
source.fetch(sandbox)
|
@@ -321,7 +318,13 @@ module Pod
|
|
321
318
|
def resolve_dependencies
|
322
319
|
specs_by_target = nil
|
323
320
|
UI.section "Resolving dependencies of #{UI.path podfile.defined_in_file}" do
|
324
|
-
|
321
|
+
if podfile.sources.empty?
|
322
|
+
sources = SourcesManager.master
|
323
|
+
else
|
324
|
+
sources = SourcesManager.sources(podfile.sources)
|
325
|
+
end
|
326
|
+
|
327
|
+
resolver = Resolver.new(sandbox, podfile, locked_dependencies, sources)
|
325
328
|
specs_by_target = resolver.resolve
|
326
329
|
end
|
327
330
|
specs_by_target
|
@@ -343,7 +346,7 @@ module Pod
|
|
343
346
|
#
|
344
347
|
def generate_sandbox_state
|
345
348
|
sandbox_state = nil
|
346
|
-
UI.section
|
349
|
+
UI.section 'Comparing resolved specification to the sandbox manifest' do
|
347
350
|
sandbox_analyzer = SandboxAnalyzer.new(sandbox, result.specifications, update_mode?, lockfile)
|
348
351
|
sandbox_state = sandbox_analyzer.analyze
|
349
352
|
sandbox_state.print
|
@@ -381,7 +384,7 @@ module Pod
|
|
381
384
|
path = "#{path}.xcodeproj" unless File.extname(path) == '.xcodeproj'
|
382
385
|
path = Pathname.new(path)
|
383
386
|
unless path.exist?
|
384
|
-
raise Informative,
|
387
|
+
raise Informative, 'Unable to find the Xcode project ' \
|
385
388
|
"`#{path}` for the target `#{target_definition.label}`."
|
386
389
|
end
|
387
390
|
|
@@ -390,7 +393,7 @@ module Pod
|
|
390
393
|
if xcodeprojs.size == 1
|
391
394
|
path = xcodeprojs.first
|
392
395
|
else
|
393
|
-
raise Informative,
|
396
|
+
raise Informative, 'Could not automatically select an Xcode project. ' \
|
394
397
|
"Specify one in your Podfile like so:\n\n" \
|
395
398
|
" xcodeproj 'path/to/Project.xcodeproj'\n"
|
396
399
|
end
|
@@ -417,12 +420,12 @@ module Pod
|
|
417
420
|
targets = native_targets(user_project).select { |t| link_with.include?(t.name) }
|
418
421
|
raise Informative, "Unable to find the targets named `#{link_with.to_sentence}` to link with target definition `#{target_definition.name}`" if targets.empty?
|
419
422
|
elsif target_definition.link_with_first_target?
|
420
|
-
targets = [
|
421
|
-
raise Informative,
|
423
|
+
targets = [native_targets(user_project).first].compact
|
424
|
+
raise Informative, 'Unable to find a target' if targets.empty?
|
422
425
|
else
|
423
426
|
target = native_targets(user_project).find { |t| t.name == target_definition.name.to_s }
|
424
|
-
targets = [
|
425
|
-
raise Informative, "Unable to find a target named `#{target_definition.name
|
427
|
+
targets = [target].compact
|
428
|
+
raise Informative, "Unable to find a target named `#{target_definition.name}`" if targets.empty?
|
426
429
|
end
|
427
430
|
targets
|
428
431
|
end
|
@@ -442,10 +445,8 @@ module Pod
|
|
442
445
|
#
|
443
446
|
def compute_user_build_configurations(target_definition, user_targets)
|
444
447
|
if user_targets
|
445
|
-
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.
|
446
|
-
|
447
|
-
hash[name] = :release
|
448
|
-
end
|
448
|
+
user_targets.map { |t| t.build_configurations.map(&:name) }.flatten.reduce({}) do |hash, name|
|
449
|
+
hash[name] = name == 'Debug' ? :debug : :release
|
449
450
|
hash
|
450
451
|
end.merge(target_definition.build_configurations || {})
|
451
452
|
else
|
@@ -468,7 +469,7 @@ module Pod
|
|
468
469
|
|
469
470
|
user_targets.each do |target|
|
470
471
|
name ||= target.platform_name
|
471
|
-
raise Informative,
|
472
|
+
raise Informative, 'Targets with different platforms' unless name == target.platform_name
|
472
473
|
if !deployment_target || deployment_target > Version.new(target.deployment_target)
|
473
474
|
deployment_target = Version.new(target.deployment_target)
|
474
475
|
end
|
@@ -494,12 +495,10 @@ module Pod
|
|
494
495
|
end
|
495
496
|
|
496
497
|
archs = archs.compact.uniq.sort
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
end
|
502
|
-
archs.first
|
498
|
+
UI.message("Using `ARCHS` setting to build architectures of " \
|
499
|
+
"target `#{target_definition.label}`: " \
|
500
|
+
"(`#{archs.join('`, `')}`)")
|
501
|
+
archs.length > 1 ? archs : archs.first
|
503
502
|
end
|
504
503
|
|
505
504
|
# Precompute the platforms for each target_definition in the Podfile
|
@@ -511,17 +510,19 @@ module Pod
|
|
511
510
|
# @return [void]
|
512
511
|
#
|
513
512
|
def compute_target_platforms
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
513
|
+
UI.section 'Inspecting targets to integrate' do
|
514
|
+
podfile.target_definition_list.each do |target_definition|
|
515
|
+
if config.integrate_targets?
|
516
|
+
project_path = compute_user_project_path(target_definition)
|
517
|
+
user_project = Xcodeproj::Project.open(project_path)
|
518
|
+
targets = compute_user_project_targets(target_definition, user_project)
|
519
|
+
platform = compute_platform_for_target_definition(target_definition, targets)
|
520
|
+
archs = compute_archs_for_target_definition(target_definition, targets)
|
521
|
+
@archs_by_target_def[target_definition] = archs
|
522
|
+
else
|
523
|
+
unless target_definition.platform
|
524
|
+
raise Informative, 'It is necessary to specify the platform in the Podfile if not integrating.'
|
525
|
+
end
|
525
526
|
end
|
526
527
|
end
|
527
528
|
end
|
@@ -530,7 +531,6 @@ module Pod
|
|
530
531
|
#-----------------------------------------------------------------------#
|
531
532
|
|
532
533
|
class AnalysisResult
|
533
|
-
|
534
534
|
# @return [SpecsState] the states of the Podfile specs.
|
535
535
|
#
|
536
536
|
attr_accessor :podfile_state
|
@@ -561,7 +561,7 @@ module Pod
|
|
561
561
|
# its type (`:debug` or `:release`).
|
562
562
|
#
|
563
563
|
def all_user_build_configurations
|
564
|
-
targets.
|
564
|
+
targets.reduce({}) do |result, target|
|
565
565
|
result.merge(target.user_build_configurations)
|
566
566
|
end
|
567
567
|
end
|
@@ -578,7 +578,6 @@ module Pod
|
|
578
578
|
# subspecs are added instead of the name of the Pods.
|
579
579
|
#
|
580
580
|
class SpecsState
|
581
|
-
|
582
581
|
# @param [Hash{Symbol=>String}] pods_by_state
|
583
582
|
# The **root** name of the pods grouped by their state
|
584
583
|
# (`:added`, `:removed`, `:changed` or `:unchanged`).
|
@@ -618,10 +617,10 @@ module Pod
|
|
618
617
|
# @return [void]
|
619
618
|
#
|
620
619
|
def print
|
621
|
-
added .sort.each { |pod| UI.message(
|
622
|
-
deleted .sort.each { |pod| UI.message(
|
623
|
-
changed .sort.each { |pod| UI.message(
|
624
|
-
unchanged.sort.each { |pod| UI.message(
|
620
|
+
added .sort.each { |pod| UI.message('A'.green + " #{pod}", '', 2) }
|
621
|
+
deleted .sort.each { |pod| UI.message('R'.red + " #{pod}", '', 2) }
|
622
|
+
changed .sort.each { |pod| UI.message('M'.yellow + " #{pod}", '', 2) }
|
623
|
+
unchanged.sort.each { |pod| UI.message('-' + " #{pod}", '', 2) }
|
625
624
|
end
|
626
625
|
|
627
626
|
# Adds the name of a Pod to the give state.
|
@@ -637,10 +636,9 @@ module Pod
|
|
637
636
|
# @return [void]
|
638
637
|
#
|
639
638
|
def add_name(name, state)
|
640
|
-
raise
|
641
|
-
|
639
|
+
raise '[Bug] Attempt to add subspec to the pods state' if name.include?('/')
|
640
|
+
send(state) << name
|
642
641
|
end
|
643
|
-
|
644
642
|
end
|
645
643
|
end
|
646
644
|
end
|