cocoapods 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +329 -0
  3. data/lib/cocoapods/command/init.rb +6 -6
  4. data/lib/cocoapods/command/ipc/list.rb +40 -0
  5. data/lib/cocoapods/command/ipc/podfile.rb +31 -0
  6. data/lib/cocoapods/command/ipc/repl.rb +51 -0
  7. data/lib/cocoapods/command/ipc/spec.rb +29 -0
  8. data/lib/cocoapods/command/ipc/update_search_index.rb +24 -0
  9. data/lib/cocoapods/command/ipc.rb +18 -0
  10. data/lib/cocoapods/command/lib/create.rb +105 -0
  11. data/lib/cocoapods/command/lib/lint.rb +111 -0
  12. data/lib/cocoapods/command/lib.rb +3 -207
  13. data/lib/cocoapods/command/repo/push.rb +44 -20
  14. data/lib/cocoapods/command/setup.rb +2 -1
  15. data/lib/cocoapods/command/spec/lint.rb +4 -0
  16. data/lib/cocoapods/command.rb +2 -1
  17. data/lib/cocoapods/config.rb +4 -1
  18. data/lib/cocoapods/downloader/cache.rb +1 -0
  19. data/lib/cocoapods/downloader.rb +20 -0
  20. data/lib/cocoapods/executable.rb +1 -1
  21. data/lib/cocoapods/gem_version.rb +1 -1
  22. data/lib/cocoapods/generator/acknowledgements/plist.rb +4 -1
  23. data/lib/cocoapods/generator/copy_resources_script.rb +4 -10
  24. data/lib/cocoapods/generator/header.rb +2 -1
  25. data/lib/cocoapods/generator/prefix_header.rb +0 -12
  26. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +38 -5
  27. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +5 -4
  28. data/lib/cocoapods/installer/analyzer/pod_variant_set.rb +5 -1
  29. data/lib/cocoapods/installer/analyzer/target_inspector.rb +24 -1
  30. data/lib/cocoapods/installer/analyzer.rb +161 -1
  31. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +29 -9
  32. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +204 -0
  33. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +314 -0
  34. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +401 -0
  35. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +214 -0
  36. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +265 -0
  37. data/lib/cocoapods/installer/xcode.rb +7 -0
  38. data/lib/cocoapods/installer.rb +50 -214
  39. data/lib/cocoapods/resolver.rb +15 -9
  40. data/lib/cocoapods/sandbox/headers_store.rb +4 -10
  41. data/lib/cocoapods/sandbox/path_list.rb +20 -9
  42. data/lib/cocoapods/sources_manager.rb +7 -10
  43. data/lib/cocoapods/target/aggregate_target.rb +20 -0
  44. data/lib/cocoapods/target/pod_target.rb +37 -7
  45. data/lib/cocoapods/user_interface/error_report.rb +7 -0
  46. data/lib/cocoapods/user_interface/inspector_reporter.rb +109 -0
  47. data/lib/cocoapods/user_interface.rb +7 -5
  48. data/lib/cocoapods/validator.rb +59 -11
  49. metadata +112 -83
  50. data/lib/cocoapods/command/inter_process_communication.rb +0 -177
  51. data/lib/cocoapods/installer/file_references_installer.rb +0 -310
  52. data/lib/cocoapods/installer/migrator.rb +0 -86
  53. data/lib/cocoapods/installer/target_installer/aggregate_target_installer.rb +0 -191
  54. data/lib/cocoapods/installer/target_installer/pod_target_installer.rb +0 -368
  55. data/lib/cocoapods/installer/target_installer.rb +0 -210
@@ -0,0 +1,265 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ # The {PodsProjectGenerator} handles generation of the 'Pods/Pods.xcodeproj'
5
+ #
6
+ class PodsProjectGenerator
7
+ require 'cocoapods/installer/xcode/pods_project_generator/target_installer'
8
+ require 'cocoapods/installer/xcode/pods_project_generator/pod_target_installer'
9
+ require 'cocoapods/installer/xcode/pods_project_generator/file_references_installer'
10
+ require 'cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer'
11
+
12
+ # @return [Pod::Project] the `Pods/Pods.xcodeproj` project.
13
+ #
14
+ attr_reader :project
15
+
16
+ # @return [Array<AggregateTarget>] The model representations of an
17
+ # aggregation of pod targets generated for a target definition
18
+ # in the Podfile.
19
+ #
20
+ attr_reader :aggregate_targets
21
+
22
+ # @return [Sandbox] The sandbox where the Pods should be installed.
23
+ #
24
+ attr_reader :sandbox
25
+
26
+ # @return [Array<PodTarget>] The model representations of pod targets.
27
+ #
28
+ attr_reader :pod_targets
29
+
30
+ # @return [Analyzer] the analyzer which provides the information about what
31
+ # needs to be installed.
32
+ #
33
+ attr_reader :analysis_result
34
+
35
+ # @return [InstallationOptions] the installation options from the Podfile.
36
+ #
37
+ attr_reader :installation_options
38
+
39
+ # @return [Config] the global CocoaPods configuration.
40
+ #
41
+ attr_reader :config
42
+
43
+ # Initialize a new instance
44
+ #
45
+ # @param [Array<AggregateTarget>] aggregate_targets @see aggregate_targets
46
+ # @param [Sandbox] sandbox @see sandbox
47
+ # @param [Array<PodTarget>] pod_targets @see pod_targets
48
+ # @param [Analyzer] analysis_result @see analysis_result
49
+ # @param [InstallationOptions] installation_options @see installation_options
50
+ # @param [Config] config @see config
51
+ #
52
+ def initialize(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
53
+ @aggregate_targets = aggregate_targets
54
+ @sandbox = sandbox
55
+ @pod_targets = pod_targets
56
+ @analysis_result = analysis_result
57
+ @installation_options = installation_options
58
+ @config = config
59
+ end
60
+
61
+ def generate!
62
+ prepare
63
+ install_file_references
64
+ install_libraries
65
+ set_target_dependencies
66
+ end
67
+
68
+ def write
69
+ UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
70
+ project.pods.remove_from_project if project.pods.empty?
71
+ project.development_pods.remove_from_project if project.development_pods.empty?
72
+ project.sort(:groups_position => :below)
73
+ if installation_options.deterministic_uuids?
74
+ UI.message('- Generating deterministic UUIDs') { project.predictabilize_uuids }
75
+ end
76
+ project.recreate_user_schemes(false)
77
+ project.save
78
+ end
79
+ end
80
+
81
+ # Shares schemes of development Pods.
82
+ #
83
+ # @return [void]
84
+ #
85
+ def share_development_pod_schemes
86
+ development_pod_targets.select(&:should_build?).each do |pod_target|
87
+ next unless share_scheme_for_development_pod?(pod_target.pod_name)
88
+ Xcodeproj::XCScheme.share_scheme(project.path, pod_target.label)
89
+ end
90
+ end
91
+
92
+ private
93
+
94
+ def create_project
95
+ if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
96
+ Pod::Project.new(sandbox.project_path, false, object_version)
97
+ else
98
+ Pod::Project.new(sandbox.project_path)
99
+ end
100
+ end
101
+
102
+ # Creates the Pods project from scratch if it doesn't exists.
103
+ #
104
+ # @return [void]
105
+ #
106
+ # @todo Clean and modify the project if it exists.
107
+ #
108
+ def prepare
109
+ UI.message '- Creating Pods project' do
110
+ @project = create_project
111
+ analysis_result.all_user_build_configurations.each do |name, type|
112
+ @project.add_build_configuration(name, type)
113
+ end
114
+
115
+ pod_names = pod_targets.map(&:pod_name).uniq
116
+ pod_names.each do |pod_name|
117
+ local = sandbox.local?(pod_name)
118
+ path = sandbox.pod_dir(pod_name)
119
+ was_absolute = sandbox.local_path_was_absolute?(pod_name)
120
+ @project.add_pod_group(pod_name, path, local, was_absolute)
121
+ end
122
+
123
+ if config.podfile_path
124
+ @project.add_podfile(config.podfile_path)
125
+ end
126
+
127
+ sandbox.project = @project
128
+ platforms = aggregate_targets.map(&:platform)
129
+ osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
130
+ ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
131
+ watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
132
+ tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
133
+ @project.build_configurations.each do |build_configuration|
134
+ build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
135
+ build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
136
+ build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
137
+ build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
138
+ build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
139
+ build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
140
+ build_configuration.build_settings['CODE_SIGNING_REQUIRED'] = 'NO'
141
+ build_configuration.build_settings['PROVISIONING_PROFILE_SPECIFIER'] = 'NO_SIGNING/' # a bogus provisioning profile ID assumed to be invalid
142
+ end
143
+ end
144
+ end
145
+
146
+ def install_file_references
147
+ installer = FileReferencesInstaller.new(sandbox, pod_targets, project)
148
+ installer.install!
149
+ end
150
+
151
+ def install_libraries
152
+ UI.message '- Installing targets' do
153
+ pod_targets.sort_by(&:name).each do |pod_target|
154
+ target_installer = PodTargetInstaller.new(sandbox, pod_target)
155
+ target_installer.install!
156
+ end
157
+
158
+ aggregate_targets.sort_by(&:name).each do |target|
159
+ target_installer = AggregateTargetInstaller.new(sandbox, target)
160
+ target_installer.install!
161
+ end
162
+
163
+ add_system_framework_dependencies
164
+ end
165
+ end
166
+
167
+ def add_system_framework_dependencies
168
+ # @TODO: Add Specs
169
+ pod_targets.sort_by(&:name).each do |pod_target|
170
+ pod_target.file_accessors.each do |file_accessor|
171
+ file_accessor.spec_consumer.frameworks.each do |framework|
172
+ if pod_target.should_build?
173
+ pod_target.native_target.add_system_framework(framework)
174
+ end
175
+ end
176
+ end
177
+ end
178
+ end
179
+
180
+ # Adds a target dependency for each pod spec to each aggregate target and
181
+ # links the pod targets among each other.
182
+ #
183
+ # @return [void]
184
+ #
185
+ def set_target_dependencies
186
+ frameworks_group = project.frameworks_group
187
+ aggregate_targets.each do |aggregate_target|
188
+ is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
189
+ [:app_extension, :watch_extension, :watch2_extension, :tv_extension, :messages_extension]).empty?
190
+ is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
191
+
192
+ aggregate_target.pod_targets.each do |pod_target|
193
+ configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
194
+
195
+ unless pod_target.should_build?
196
+ pod_target.resource_bundle_targets.each do |resource_bundle_target|
197
+ aggregate_target.native_target.add_dependency(resource_bundle_target)
198
+ end
199
+
200
+ next
201
+ end
202
+
203
+ aggregate_target.native_target.add_dependency(pod_target.native_target)
204
+ configure_app_extension_api_only_for_target(pod_target) if is_app_extension
205
+
206
+ pod_target.dependent_targets.each do |pod_dependency_target|
207
+ next unless pod_dependency_target.should_build?
208
+ pod_target.native_target.add_dependency(pod_dependency_target.native_target)
209
+ configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
210
+
211
+ if pod_target.requires_frameworks?
212
+ product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
213
+ frameworks_group.new_product_ref_for_target(pod_dependency_target.product_basename, pod_dependency_target.product_type)
214
+ pod_target.native_target.frameworks_build_phase.add_file_reference(product_ref, true)
215
+ end
216
+ end
217
+ end
218
+ end
219
+ end
220
+
221
+ # @param [String] pod The root name of the development pod.
222
+ #
223
+ # @return [Bool] whether the scheme for the given development pod should be
224
+ # shared.
225
+ #
226
+ def share_scheme_for_development_pod?(pod)
227
+ case dev_pods_to_share = installation_options.share_schemes_for_development_pods
228
+ when TrueClass, FalseClass, NilClass
229
+ dev_pods_to_share
230
+ when Array
231
+ dev_pods_to_share.any? { |dev_pod| dev_pod === pod } # rubocop:disable Style/CaseEquality
232
+ else
233
+ raise Informative, 'Unable to handle share_schemes_for_development_pods ' \
234
+ "being set to #{dev_pods_to_share.inspect} -- please set it to true, " \
235
+ 'false, or an array of pods to share schemes for.'
236
+ end
237
+ end
238
+
239
+ # @return [Array<Library>] The targets of the development pods generated by
240
+ # the installation process.
241
+ #
242
+ def development_pod_targets
243
+ pod_targets.select do |pod_target|
244
+ sandbox.development_pods.keys.include?(pod_target.pod_name)
245
+ end
246
+ end
247
+
248
+ #------------------------------------------------------------------------#
249
+
250
+ # @! group Private Helpers
251
+
252
+ private
253
+
254
+ # Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
255
+ # configurations of the given target
256
+ #
257
+ def configure_app_extension_api_only_for_target(target)
258
+ target.native_target.build_configurations.each do |config|
259
+ config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
260
+ end
261
+ end
262
+ end
263
+ end
264
+ end
265
+ end
@@ -0,0 +1,7 @@
1
+ module Pod
2
+ class Installer
3
+ class Xcode
4
+ autoload :PodsProjectGenerator, 'cocoapods/installer/xcode/pods_project_generator'
5
+ end
6
+ end
7
+ end
@@ -29,20 +29,16 @@ module Pod
29
29
  # source control.
30
30
  #
31
31
  class Installer
32
- autoload :AggregateTargetInstaller, 'cocoapods/installer/target_installer/aggregate_target_installer'
33
32
  autoload :Analyzer, 'cocoapods/installer/analyzer'
34
- autoload :FileReferencesInstaller, 'cocoapods/installer/file_references_installer'
35
33
  autoload :InstallationOptions, 'cocoapods/installer/installation_options'
36
34
  autoload :PostInstallHooksContext, 'cocoapods/installer/post_install_hooks_context'
37
35
  autoload :PreInstallHooksContext, 'cocoapods/installer/pre_install_hooks_context'
38
36
  autoload :SourceProviderHooksContext, 'cocoapods/installer/source_provider_hooks_context'
39
- autoload :Migrator, 'cocoapods/installer/migrator'
40
37
  autoload :PodfileValidator, 'cocoapods/installer/podfile_validator'
41
38
  autoload :PodSourceInstaller, 'cocoapods/installer/pod_source_installer'
42
39
  autoload :PodSourcePreparer, 'cocoapods/installer/pod_source_preparer'
43
- autoload :PodTargetInstaller, 'cocoapods/installer/target_installer/pod_target_installer'
44
- autoload :TargetInstaller, 'cocoapods/installer/target_installer'
45
40
  autoload :UserProjectIntegrator, 'cocoapods/installer/user_project_integrator'
41
+ autoload :Xcode, 'cocoapods/installer/xcode'
46
42
 
47
43
  include Config::Mixin
48
44
  include InstallationOptions::Mixin
@@ -84,7 +80,7 @@ module Pod
84
80
  #
85
81
  attr_accessor :update
86
82
 
87
- # @return [Bool] Whether the spec repos should be updated.
83
+ # @return [Boolean] Whether the spec repos should be updated.
88
84
  #
89
85
  attr_accessor :repo_update
90
86
  alias_method :repo_update?, :repo_update
@@ -113,11 +109,15 @@ module Pod
113
109
  prepare
114
110
  resolve_dependencies
115
111
  download_dependencies
116
- verify_no_duplicate_framework_names
112
+ verify_no_duplicate_framework_and_library_names
117
113
  verify_no_static_framework_transitive_dependencies
118
114
  verify_framework_usage
119
115
  generate_pods_project
120
- integrate_user_project if installation_options.integrate_targets?
116
+ if installation_options.integrate_targets?
117
+ integrate_user_project
118
+ else
119
+ UI.section 'Skipping User Project Integration'
120
+ end
121
121
  perform_post_install_actions
122
122
  end
123
123
 
@@ -132,7 +132,6 @@ module Pod
132
132
  deintegrate_if_different_major_version
133
133
  sandbox.prepare
134
134
  ensure_plugins_are_installed!
135
- Migrator.migrate(sandbox)
136
135
  run_plugins_pre_install_hooks
137
136
  end
138
137
  end
@@ -163,15 +162,25 @@ module Pod
163
162
  end
164
163
  end
165
164
 
166
- def generate_pods_project
165
+ #-------------------------------------------------------------------------#
166
+
167
+ # @!group Pods Project Generation
168
+
169
+ private
170
+
171
+ def create_generator
172
+ Xcode::PodsProjectGenerator.new(aggregate_targets, sandbox, pod_targets, analysis_result, installation_options, config)
173
+ end
174
+
175
+ # Generate the 'Pods/Pods.xcodeproj' project.
176
+ #
177
+ def generate_pods_project(generator = create_generator)
167
178
  UI.section 'Generating Pods project' do
168
- prepare_pods_project
169
- install_file_references
170
- install_libraries
171
- set_target_dependencies
179
+ generator.generate!
180
+ @pods_project = generator.project
172
181
  run_podfile_post_install_hooks
173
- write_pod_project
174
- share_development_pod_schemes
182
+ generator.write
183
+ generator.share_development_pod_schemes
175
184
  write_lockfiles
176
185
  end
177
186
  end
@@ -382,23 +391,32 @@ module Pod
382
391
  end
383
392
  end
384
393
 
385
- def verify_no_duplicate_framework_names
394
+ def verify_no_duplicate_framework_and_library_names
386
395
  aggregate_targets.each do |aggregate_target|
387
396
  aggregate_target.user_build_configurations.keys.each do |config|
388
397
  pod_targets = aggregate_target.pod_targets_for_build_configuration(config)
389
- vendored_frameworks = pod_targets.flat_map(&:file_accessors).flat_map(&:vendored_frameworks).uniq
390
- frameworks = vendored_frameworks.map { |fw| fw.basename('.framework') }
398
+ file_accessors = pod_targets.flat_map(&:file_accessors)
399
+
400
+ frameworks = file_accessors.flat_map(&:vendored_frameworks).uniq.map(&:basename)
391
401
  frameworks += pod_targets.select { |pt| pt.should_build? && pt.requires_frameworks? }.map(&:product_module_name)
402
+ verify_no_duplicate_names(frameworks, aggregate_target.label, 'frameworks')
392
403
 
393
- duplicates = frameworks.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
394
- unless duplicates.empty?
395
- raise Informative, "The '#{aggregate_target.label}' target has " \
396
- "frameworks with conflicting names: #{duplicates.to_sentence}."
397
- end
404
+ libraries = file_accessors.flat_map(&:vendored_libraries).uniq.map(&:basename)
405
+ libraries += pod_targets.select { |pt| pt.should_build? && !pt.requires_frameworks? }.map(&:product_name)
406
+ verify_no_duplicate_names(libraries, aggregate_target.label, 'libraries')
398
407
  end
399
408
  end
400
409
  end
401
410
 
411
+ def verify_no_duplicate_names(names, label, type)
412
+ duplicates = names.map { |n| n.to_s.downcase }.group_by { |f| f }.select { |_, v| v.size > 1 }.keys
413
+
414
+ unless duplicates.empty?
415
+ raise Informative, "The '#{label}' target has " \
416
+ "#{type} with conflicting names: #{duplicates.to_sentence}."
417
+ end
418
+ end
419
+
402
420
  def verify_no_static_framework_transitive_dependencies
403
421
  aggregate_targets.each do |aggregate_target|
404
422
  next unless aggregate_target.requires_frameworks?
@@ -460,10 +478,12 @@ module Pod
460
478
  def print_post_install_message
461
479
  podfile_dependencies = podfile.dependencies.uniq.size
462
480
  pods_installed = root_specs.size
463
- UI.info('Pod installation complete! ' \
464
- "There #{podfile_dependencies == 1 ? 'is' : 'are'} #{podfile_dependencies} " \
465
- "#{'dependency'.pluralize(podfile_dependencies)} from the Podfile " \
466
- "and #{pods_installed} total #{'pod'.pluralize(pods_installed)} installed.")
481
+ title_options = { :verbose_prefix => '-> '.green }
482
+ UI.titled_section('Pod installation complete! ' \
483
+ "There #{podfile_dependencies == 1 ? 'is' : 'are'} #{podfile_dependencies} " \
484
+ "#{'dependency'.pluralize(podfile_dependencies)} from the Podfile " \
485
+ "and #{pods_installed} total #{'pod'.pluralize(pods_installed)} installed.".green,
486
+ title_options)
467
487
  end
468
488
 
469
489
  # Runs the registered callbacks for the plugins post install hooks.
@@ -551,181 +571,6 @@ module Pod
551
571
  end
552
572
  end
553
573
 
554
- # Creates the Pods project from scratch if it doesn't exists.
555
- #
556
- # @return [void]
557
- #
558
- # @todo Clean and modify the project if it exists.
559
- #
560
- def prepare_pods_project
561
- UI.message '- Creating Pods project' do
562
- @pods_project = if object_version = aggregate_targets.map(&:user_project).compact.map { |p| p.object_version.to_i }.min
563
- Pod::Project.new(sandbox.project_path, false, object_version)
564
- else
565
- Pod::Project.new(sandbox.project_path)
566
- end
567
-
568
- analysis_result.all_user_build_configurations.each do |name, type|
569
- @pods_project.add_build_configuration(name, type)
570
- end
571
-
572
- pod_names = pod_targets.map(&:pod_name).uniq
573
- pod_names.each do |pod_name|
574
- local = sandbox.local?(pod_name)
575
- path = sandbox.pod_dir(pod_name)
576
- was_absolute = sandbox.local_path_was_absolute?(pod_name)
577
- @pods_project.add_pod_group(pod_name, path, local, was_absolute)
578
- end
579
-
580
- if config.podfile_path
581
- @pods_project.add_podfile(config.podfile_path)
582
- end
583
-
584
- sandbox.project = @pods_project
585
- platforms = aggregate_targets.map(&:platform)
586
- osx_deployment_target = platforms.select { |p| p.name == :osx }.map(&:deployment_target).min
587
- ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
588
- watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
589
- tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
590
- @pods_project.build_configurations.each do |build_configuration|
591
- build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
592
- build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
593
- build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
594
- build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
595
- build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
596
- build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
597
- end
598
- end
599
- end
600
-
601
- # Installs the file references in the Pods project. This is done once per
602
- # Pod as the same file reference might be shared by multiple aggregate
603
- # targets.
604
- #
605
- # @return [void]
606
- #
607
- def install_file_references
608
- installer = FileReferencesInstaller.new(sandbox, pod_targets, pods_project)
609
- installer.install!
610
- end
611
-
612
- # Installs the aggregate targets of the Pods projects and generates their
613
- # support files.
614
- #
615
- # @return [void]
616
- #
617
- def install_libraries
618
- UI.message '- Installing targets' do
619
- pod_targets.sort_by(&:name).each do |pod_target|
620
- target_installer = PodTargetInstaller.new(sandbox, pod_target)
621
- target_installer.install!
622
- end
623
-
624
- aggregate_targets.sort_by(&:name).each do |target|
625
- target_installer = AggregateTargetInstaller.new(sandbox, target)
626
- target_installer.install!
627
- end
628
-
629
- # TODO: Move and add specs
630
- pod_targets.sort_by(&:name).each do |pod_target|
631
- pod_target.file_accessors.each do |file_accessor|
632
- file_accessor.spec_consumer.frameworks.each do |framework|
633
- if pod_target.should_build?
634
- pod_target.native_target.add_system_framework(framework)
635
- end
636
- end
637
- end
638
- end
639
- end
640
- end
641
-
642
- # Adds a target dependency for each pod spec to each aggregate target and
643
- # links the pod targets among each other.
644
- #
645
- # @return [void]
646
- #
647
- def set_target_dependencies
648
- frameworks_group = pods_project.frameworks_group
649
- aggregate_targets.each do |aggregate_target|
650
- is_app_extension = !(aggregate_target.user_targets.map(&:symbol_type) &
651
- [:app_extension, :watch_extension, :watch2_extension, :tv_extension]).empty?
652
- is_app_extension ||= aggregate_target.user_targets.any? { |ut| ut.common_resolved_build_setting('APPLICATION_EXTENSION_API_ONLY') == 'YES' }
653
-
654
- aggregate_target.pod_targets.each do |pod_target|
655
- configure_app_extension_api_only_for_target(aggregate_target) if is_app_extension
656
-
657
- unless pod_target.should_build?
658
- pod_target.resource_bundle_targets.each do |resource_bundle_target|
659
- aggregate_target.native_target.add_dependency(resource_bundle_target)
660
- end
661
-
662
- next
663
- end
664
-
665
- aggregate_target.native_target.add_dependency(pod_target.native_target)
666
- configure_app_extension_api_only_for_target(pod_target) if is_app_extension
667
-
668
- pod_target.dependent_targets.each do |pod_dependency_target|
669
- next unless pod_dependency_target.should_build?
670
- pod_target.native_target.add_dependency(pod_dependency_target.native_target)
671
- configure_app_extension_api_only_for_target(pod_dependency_target) if is_app_extension
672
-
673
- if pod_target.requires_frameworks?
674
- product_ref = frameworks_group.files.find { |f| f.path == pod_dependency_target.product_name } ||
675
- frameworks_group.new_product_ref_for_target(pod_dependency_target.product_basename, pod_dependency_target.product_type)
676
- pod_target.native_target.frameworks_build_phase.add_file_reference(product_ref, true)
677
- end
678
- end
679
- end
680
- end
681
- end
682
-
683
- # Writes the Pods project to the disk.
684
- #
685
- # @return [void]
686
- #
687
- def write_pod_project
688
- UI.message "- Writing Xcode project file to #{UI.path sandbox.project_path}" do
689
- pods_project.pods.remove_from_project if pods_project.pods.empty?
690
- pods_project.development_pods.remove_from_project if pods_project.development_pods.empty?
691
- pods_project.sort(:groups_position => :below)
692
- if installation_options.deterministic_uuids?
693
- UI.message('- Generating deterministic UUIDs') { pods_project.predictabilize_uuids }
694
- end
695
- pods_project.recreate_user_schemes(false)
696
- pods_project.save
697
- end
698
- end
699
-
700
- # Shares schemes of development Pods.
701
- #
702
- # @return [void]
703
- #
704
- def share_development_pod_schemes
705
- development_pod_targets.select(&:should_build?).each do |pod_target|
706
- next unless share_scheme_for_development_pod?(pod_target.pod_name)
707
- Xcodeproj::XCScheme.share_scheme(pods_project.path, pod_target.label)
708
- end
709
- end
710
-
711
- # @param [String] pod The root name of the development pod.
712
- #
713
- # @return [Bool] whether the scheme for the given development pod should be
714
- # shared.
715
- #
716
- def share_scheme_for_development_pod?(pod)
717
- case dev_pods_to_share = installation_options.share_schemes_for_development_pods
718
- when TrueClass, FalseClass, NilClass
719
- dev_pods_to_share
720
- when Array
721
- dev_pods_to_share.any? { |dev_pod| dev_pod === pod } # rubocop:disable Style/CaseEquality
722
- else
723
- raise Informative, 'Unable to handle share_schemes_for_development_pods ' \
724
- "being set to #{dev_pods_to_share.inspect} -- please set it to true, " \
725
- 'false, or an array of pods to share schemes for.'
726
- end
727
- end
728
-
729
574
  # Writes the Podfile and the lock files.
730
575
  #
731
576
  # @todo Pass the checkout options to the Lockfile.
@@ -789,7 +634,7 @@ module Pod
789
634
  #
790
635
  # @raise Raises an informative if the hooks raises.
791
636
  #
792
- # @return [Bool] Whether the hook was run.
637
+ # @return [Boolean] Whether the hook was run.
793
638
  #
794
639
  def run_podfile_pre_install_hook
795
640
  podfile.pre_install!(self)
@@ -817,7 +662,7 @@ module Pod
817
662
  #
818
663
  # @raise Raises an informative if the hooks raises.
819
664
  #
820
- # @return [Bool] Whether the hook was run.
665
+ # @return [Boolean] Whether the hook was run.
821
666
  #
822
667
  def run_podfile_post_install_hook
823
668
  podfile.post_install!(self)
@@ -859,15 +704,6 @@ module Pod
859
704
  analysis_result.sandbox_state
860
705
  end
861
706
 
862
- # Sets the APPLICATION_EXTENSION_API_ONLY build setting to YES for all
863
- # configurations of the given target
864
- #
865
- def configure_app_extension_api_only_for_target(target)
866
- target.native_target.build_configurations.each do |config|
867
- config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
868
- end
869
- end
870
-
871
707
  #-------------------------------------------------------------------------#
872
708
  end
873
709
  end