cocoapods 1.10.0 → 1.16.0

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +571 -7
  3. data/README.md +10 -11
  4. data/bin/sandbox-pod +1 -1
  5. data/lib/cocoapods/command/lib/lint.rb +4 -1
  6. data/lib/cocoapods/command/outdated.rb +12 -1
  7. data/lib/cocoapods/command/repo/push.rb +20 -0
  8. data/lib/cocoapods/command/setup.rb +2 -2
  9. data/lib/cocoapods/command/spec/cat.rb +3 -1
  10. data/lib/cocoapods/command/spec/create.rb +1 -0
  11. data/lib/cocoapods/command/spec/lint.rb +4 -1
  12. data/lib/cocoapods/command/spec/which.rb +3 -1
  13. data/lib/cocoapods/command/spec.rb +18 -9
  14. data/lib/cocoapods/config.rb +8 -7
  15. data/lib/cocoapods/downloader/cache.rb +98 -6
  16. data/lib/cocoapods/downloader.rb +4 -2
  17. data/lib/cocoapods/executable.rb +1 -1
  18. data/lib/cocoapods/external_sources/abstract_external_source.rb +1 -1
  19. data/lib/cocoapods/external_sources/path_source.rb +1 -1
  20. data/lib/cocoapods/external_sources/podspec_source.rb +1 -1
  21. data/lib/cocoapods/gem_version.rb +1 -1
  22. data/lib/cocoapods/generator/acknowledgements.rb +13 -1
  23. data/lib/cocoapods/generator/app_target_helper.rb +8 -4
  24. data/lib/cocoapods/generator/copy_dsyms_script.rb +4 -4
  25. data/lib/cocoapods/generator/copy_resources_script.rb +2 -1
  26. data/lib/cocoapods/generator/copy_xcframework_script.rb +52 -70
  27. data/lib/cocoapods/generator/embed_frameworks_script.rb +4 -3
  28. data/lib/cocoapods/generator/info_plist_file.rb +1 -1
  29. data/lib/cocoapods/generator/script_phase_constants.rb +1 -0
  30. data/lib/cocoapods/installer/analyzer/analysis_result.rb +3 -3
  31. data/lib/cocoapods/installer/analyzer/pod_variant.rb +1 -1
  32. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +38 -10
  33. data/lib/cocoapods/installer/analyzer.rb +21 -13
  34. data/lib/cocoapods/installer/base_install_hooks_context.rb +19 -4
  35. data/lib/cocoapods/installer/installation_options.rb +11 -0
  36. data/lib/cocoapods/installer/pod_source_downloader.rb +159 -0
  37. data/lib/cocoapods/installer/pod_source_installer.rb +10 -36
  38. data/lib/cocoapods/installer/podfile_validator.rb +2 -2
  39. data/lib/cocoapods/installer/pre_integrate_hooks_context.rb +9 -0
  40. data/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +14 -7
  41. data/lib/cocoapods/installer/project_cache/project_installation_cache.rb +15 -2
  42. data/lib/cocoapods/installer/project_cache/target_cache_key.rb +48 -7
  43. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +150 -9
  44. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +11 -3
  45. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +62 -9
  46. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +6 -19
  47. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +86 -59
  48. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +48 -6
  49. data/lib/cocoapods/installer/xcode/pods_project_generator/project_generator.rb +3 -1
  50. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +2 -2
  51. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +8 -5
  52. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +9 -3
  53. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +37 -2
  54. data/lib/cocoapods/installer/xcode/target_validator.rb +1 -1
  55. data/lib/cocoapods/installer.rb +150 -34
  56. data/lib/cocoapods/native_target_extension.rb +1 -1
  57. data/lib/cocoapods/open-uri.rb +1 -1
  58. data/lib/cocoapods/project.rb +8 -8
  59. data/lib/cocoapods/resolver/resolver_specification.rb +1 -1
  60. data/lib/cocoapods/resolver.rb +7 -7
  61. data/lib/cocoapods/sandbox/file_accessor.rb +67 -11
  62. data/lib/cocoapods/sandbox/headers_store.rb +3 -1
  63. data/lib/cocoapods/sandbox/path_list.rb +2 -2
  64. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +1 -1
  65. data/lib/cocoapods/sandbox.rb +48 -12
  66. data/lib/cocoapods/sources_manager.rb +18 -9
  67. data/lib/cocoapods/target/aggregate_target.rb +23 -1
  68. data/lib/cocoapods/target/build_settings.rb +67 -22
  69. data/lib/cocoapods/target/pod_target.rb +49 -24
  70. data/lib/cocoapods/target.rb +1 -1
  71. data/lib/cocoapods/user_interface.rb +6 -2
  72. data/lib/cocoapods/validator.rb +58 -22
  73. data/lib/cocoapods/version_metadata.rb +1 -1
  74. data/lib/cocoapods/xcode/xcframework/xcframework_slice.rb +22 -7
  75. data/lib/cocoapods/xcode/xcframework.rb +9 -4
  76. data/lib/cocoapods.rb +2 -0
  77. metadata +35 -27
@@ -23,7 +23,7 @@ module Pod
23
23
  # @param [Pathname] root @see #root
24
24
  #
25
25
  def initialize(root)
26
- root_dir = ActiveSupport::Multibyte::Unicode.normalize(root.to_s)
26
+ root_dir = root.to_s.unicode_normalize(:nfkc)
27
27
  @root = Pathname.new(root_dir)
28
28
  @glob_cache = {}
29
29
  end
@@ -164,7 +164,7 @@ module Pod
164
164
 
165
165
  # @!group Private helpers
166
166
 
167
- # @return [Bool] Wether a path is a directory. The result of this method
167
+ # @return [Boolean] Wether a path is a directory. The result of this method
168
168
  # computed without accessing the file system and is case
169
169
  # insensitive.
170
170
  #
@@ -64,7 +64,7 @@ module Pod
64
64
  # specifications (according to their platform) of this Pod.
65
65
  #
66
66
  def used_files
67
- FileAccessor.all_files(file_accessors)
67
+ FileAccessor.all_files(file_accessors).map(&:to_s)
68
68
  end
69
69
  end
70
70
  end
@@ -67,6 +67,7 @@ module Pod
67
67
  @root = Pathname.new(root).realpath
68
68
  @public_headers = HeadersStore.new(self, 'Public', :public)
69
69
  @predownloaded_pods = []
70
+ @downloaded_pods = []
70
71
  @checkout_sources = {}
71
72
  @development_pods = {}
72
73
  @pods_with_absolute_path = []
@@ -84,18 +85,17 @@ module Pod
84
85
 
85
86
  # Removes the files of the Pod with the given name from the sandbox.
86
87
  #
88
+ # @param [String] name The name of the pod, which is used to calculate additional paths to clean.
89
+ # @param [String] pod_dir The directory of the pod to clean.
90
+ #
87
91
  # @return [void]
88
92
  #
89
- def clean_pod(name)
90
- root_name = Specification.root_name(name)
91
- unless local?(root_name)
92
- path = pod_dir(name)
93
- path.rmtree if path.exist?
94
- end
93
+ def clean_pod(name, pod_dir)
94
+ pod_dir.rmtree if pod_dir&.exist?
95
95
  podspec_path = specification_path(name)
96
- podspec_path.rmtree if podspec_path
96
+ podspec_path.rmtree if podspec_path&.exist?
97
97
  pod_target_project_path = pod_target_project_path(name)
98
- pod_target_project_path.rmtree if pod_target_project_path.exist?
98
+ pod_target_project_path.rmtree if pod_target_project_path&.exist?
99
99
  end
100
100
 
101
101
  # Prepares the sandbox for a new installation removing any file that will
@@ -192,7 +192,7 @@ module Pod
192
192
  #
193
193
  # @param [String] name
194
194
  #
195
- # @return [Bool] true if originally absolute
195
+ # @return [Boolean] true if originally absolute
196
196
  #
197
197
  def local_path_was_absolute?(name)
198
198
  @pods_with_absolute_path.include? name
@@ -342,7 +342,7 @@ module Pod
342
342
  # @param [String] name
343
343
  # The name of the Pod.
344
344
  #
345
- # @return [Bool] Whether the Pod has been pre-downloaded.
345
+ # @return [Boolean] Whether the Pod has been pre-downloaded.
346
346
  #
347
347
  def predownloaded?(name)
348
348
  root_name = Specification.root_name(name)
@@ -351,6 +351,42 @@ module Pod
351
351
 
352
352
  #--------------------------------------#
353
353
 
354
+ # Marks a Pod as downloaded
355
+ #
356
+ # @param [String] name
357
+ # The name of the Pod.
358
+ #
359
+ # @return [void]
360
+ #
361
+ def store_downloaded_pod(name)
362
+ root_name = Specification.root_name(name)
363
+ downloaded_pods << root_name
364
+ end
365
+
366
+ # Checks if a Pod has been downloaded before the installation
367
+ # process.
368
+ #
369
+ # @param [String] name
370
+ # The name of the Pod.
371
+ #
372
+ # @return [Boolean] Whether the Pod has been downloaded.
373
+ #
374
+ def downloaded?(name)
375
+ root_name = Specification.root_name(name)
376
+ downloaded_pods.include?(root_name)
377
+ end
378
+
379
+ # @return [Array<String>] The names of the pods that have been
380
+ # downloaded before the installation process begins.
381
+ # These are distinct from the pre-downloaded pods in
382
+ # that these do not necessarily come from external
383
+ # sources, and are only downloaded right before
384
+ # installation if the parallel_pod_downloads option is on.
385
+ #
386
+ attr_reader :downloaded_pods
387
+
388
+ #--------------------------------------#
389
+
354
390
  # Stores the local path of a Pod.
355
391
  #
356
392
  # @param [String] name
@@ -406,7 +442,7 @@ module Pod
406
442
  # @param [Pathname, String] path
407
443
  # The path to the local Podspec
408
444
  #
409
- # @param [Bool] was_absolute
445
+ # @param [Boolean] was_absolute
410
446
  # True if the specified local path was absolute.
411
447
  #
412
448
  # @return [void]
@@ -428,7 +464,7 @@ module Pod
428
464
  # @param [String] name
429
465
  # The name of the Pod.
430
466
  #
431
- # @return [Bool] Whether the Pod is locally sourced.
467
+ # @return [Boolean] Whether the Pod is locally sourced.
432
468
  #
433
469
  def local?(name)
434
470
  !local_podspec(name).nil?
@@ -1,4 +1,5 @@
1
1
  require 'cocoapods-core/source'
2
+ require 'cocoapods/open-uri'
2
3
  require 'netrc'
3
4
  require 'set'
4
5
  require 'rest'
@@ -70,15 +71,23 @@ module Pod
70
71
  # The URL of the source.
71
72
  #
72
73
  def cdn_url?(url)
73
- if url =~ %r{^https?:\/\/}
74
- require 'typhoeus'
74
+ return false unless url =~ %r{^https?:\/\/}
75
75
 
76
- response = Typhoeus.get(url + '/CocoaPods-version.yml', :netrc_file => Netrc.default_path, :netrc => :optional)
77
- response.code == 200 && begin
78
- response_hash = YAML.load(response.body) # rubocop:disable Security/YAMLLoad
79
- response_hash.is_a?(Hash) && !Source::Metadata.new(response_hash).latest_cocoapods_version.nil?
80
- end
81
- end
76
+ uri_options = {}
77
+
78
+ netrc_info = Netrc.read
79
+ uri = URI.parse(url)
80
+ return false unless uri.userinfo.nil?
81
+
82
+ netrc_host = uri.host
83
+ credentials = netrc_info[netrc_host]
84
+ uri_options[:http_basic_authentication] = credentials if credentials
85
+
86
+ response = OpenURI.open_uri(url.chomp('/') + '/CocoaPods-version.yml', uri_options)
87
+ response_hash = YAML.load(response.read) # rubocop:disable Security/YAMLLoad
88
+ response_hash.is_a?(Hash) && !Source::Metadata.new(response_hash).latest_cocoapods_version.nil?
89
+ rescue Psych::SyntaxError, ::OpenURI::HTTPError, SocketError
90
+ return false
82
91
  rescue => e
83
92
  raise Informative, "Couldn't determine repo type for URL: `#{url}`: #{e}"
84
93
  end
@@ -110,7 +119,7 @@ module Pod
110
119
  #
111
120
  # @param [String] source_name
112
121
  #
113
- # @param [Bool] show_output
122
+ # @param [Boolean] show_output
114
123
  #
115
124
  # @return [void]
116
125
  #
@@ -225,6 +225,12 @@ module Pod
225
225
  !resource_paths_by_config.each_value.all?(&:empty?)
226
226
  end
227
227
 
228
+ # @return [Boolean] Whether the target contains any on demand resources
229
+ #
230
+ def includes_on_demand_resources?
231
+ !on_demand_resources.empty?
232
+ end
233
+
228
234
  # @return [Boolean] Whether the target contains frameworks to be embedded into
229
235
  # the user target
230
236
  #
@@ -273,6 +279,20 @@ module Pod
273
279
  end
274
280
  end
275
281
 
282
+ # @return [Array<Pathname>] Uniqued On Demand Resources for this target.
283
+ #
284
+ # @note On Demand Resources are not separated by config as they are integrated directly into the users target via
285
+ # the resources build phase.
286
+ #
287
+ def on_demand_resources
288
+ @on_demand_resources ||= begin
289
+ pod_targets.flat_map do |pod_target|
290
+ library_file_accessors = pod_target.file_accessors.select { |fa| fa.spec.library_specification? }
291
+ library_file_accessors.flat_map(&:on_demand_resources_files)
292
+ end.uniq
293
+ end
294
+ end
295
+
276
296
  # @return [Hash{String => Array<String>}] Uniqued Resources grouped by config
277
297
  #
278
298
  def resource_paths_by_config
@@ -292,7 +312,9 @@ module Pod
292
312
  extname = File.extname(resource_path)
293
313
  if self.class.resource_extension_compilable?(extname)
294
314
  output_extname = self.class.output_extension_for_resource(extname)
295
- built_product_dir.join(File.basename(resource_path, extname)).sub_ext(output_extname).to_s
315
+ output_path_components = Pathname(resource_path).each_filename.select { |component| File.extname(component) == '.lproj' }
316
+ output_path_components << File.basename(resource_path)
317
+ built_product_dir.join(*output_path_components).sub_ext(output_extname).to_s
296
318
  else
297
319
  resource_path
298
320
  end
@@ -28,6 +28,7 @@ module Pod
28
28
  OTHER_CFLAGS
29
29
  OTHER_CPLUSPLUSFLAGS
30
30
  OTHER_LDFLAGS
31
+ OTHER_MODULE_VERIFIER_FLAGS
31
32
  OTHER_SWIFT_FLAGS
32
33
  REZ_SEARCH_PATHS
33
34
  SECTORDER_FLAGS
@@ -140,12 +141,12 @@ module Pod
140
141
  end
141
142
  private_class_method :define_build_settings_method
142
143
 
143
- # @param [XCFramework] xcframework the xcframework thats slice will be copied to the intermediates dir
144
+ # @param [XCFramework] xcframework the xcframework slice that will be copied to the intermediates dir
144
145
  #
145
146
  # @return [String] the path to the directory containing the xcframework slice
146
147
  #
147
148
  def self.xcframework_intermediate_dir(xcframework)
148
- "#{XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcframework.name}"
149
+ "#{XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcframework.target_name}"
149
150
  end
150
151
 
151
152
  class << self
@@ -293,6 +294,11 @@ module Pod
293
294
  module_map_files.map { |f| "-fmodule-map-file=#{f}" }
294
295
  end
295
296
 
297
+ # @return [Array<String>]
298
+ define_build_settings_method :other_module_verifier_flags, :build_setting => true, :memoized => true do
299
+ []
300
+ end
301
+
296
302
  # @return [Array<String>]
297
303
  define_build_settings_method :module_map_files do
298
304
  []
@@ -346,18 +352,26 @@ module Pod
346
352
  #
347
353
  # @param [Boolean] test_bundle
348
354
  #
349
- def _ld_runpath_search_paths(requires_host_target: false, test_bundle: false)
355
+ def _ld_runpath_search_paths(requires_host_target: false, test_bundle: false, uses_swift: false)
356
+ paths = []
357
+ if uses_swift
358
+ paths << '/usr/lib/swift'
359
+ paths << '$(PLATFORM_DIR)/Developer/Library/Frameworks' if test_bundle
360
+ end
350
361
  if target.platform.symbolic_name == :osx
351
- ["'@executable_path/../Frameworks'",
352
- test_bundle ? "'@loader_path/../Frameworks'" : "'@loader_path/Frameworks'"]
362
+ paths << "'@executable_path/../Frameworks'"
363
+ paths << if test_bundle
364
+ "'@loader_path/../Frameworks'"
365
+ else
366
+ "'@loader_path/Frameworks'"
367
+ end
368
+ paths << '${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}' if uses_swift
353
369
  else
354
- paths = [
355
- "'@executable_path/Frameworks'",
356
- "'@loader_path/Frameworks'",
357
- ]
370
+ paths << "'@executable_path/Frameworks'"
371
+ paths << "'@loader_path/Frameworks'"
358
372
  paths << "'@executable_path/../../Frameworks'" if requires_host_target
359
- paths
360
373
  end
374
+ paths
361
375
  end
362
376
  private :_ld_runpath_search_paths
363
377
 
@@ -435,7 +449,7 @@ module Pod
435
449
  def merged_xcconfigs(xcconfig_values_by_consumer_by_key, attribute, overriding: {})
436
450
  xcconfig_values_by_consumer_by_key.each_with_object(overriding.dup) do |(key, values_by_consumer), xcconfig|
437
451
  uniq_values = values_by_consumer.values.uniq
438
- values_are_bools = uniq_values.all? { |v| v =~ /\A(yes|no)\z/i }
452
+ values_are_bools = uniq_values.all? { |v| v.is_a?(String) && v =~ /\A(yes|no)\z/i }
439
453
  if values_are_bools
440
454
  # Boolean build settings
441
455
  if uniq_values.count > 1
@@ -500,12 +514,14 @@ module Pod
500
514
  pod_targets - subset_targets
501
515
  end
502
516
 
517
+ # @param [String] target_name the name of the target this xcframework belongs to
518
+ #
503
519
  # @param [Pathname,String] path the path to the xcframework bundle
504
520
  #
505
521
  # @return [Xcode::XCFramework] the xcframework at the given path
506
522
  #
507
- def load_xcframework(path)
508
- Xcode::XCFramework.new(path)
523
+ def load_xcframework(target_name, path)
524
+ Xcode::XCFramework.new(target_name, path)
509
525
  end
510
526
 
511
527
  # A subclass that generates build settings for a {PodTarget}
@@ -592,6 +608,11 @@ module Pod
592
608
  target.pod_target_srcroot
593
609
  end
594
610
 
611
+ # @return [String]
612
+ define_build_settings_method :pods_development_language, :build_setting => true do
613
+ '${DEVELOPMENT_LANGUAGE}'
614
+ end
615
+
595
616
  #-------------------------------------------------------------------------#
596
617
 
597
618
  # @!group Frameworks
@@ -616,9 +637,15 @@ module Pod
616
637
  select { |xcf| xcf.build_type.static_framework? }.
617
638
  map(&:name).
618
639
  uniq
640
+
641
+ # Include direct dynamic dependencies to the linker flags. We used to add those in the 'Link Binary With Libraries'
642
+ # phase but we no longer do since we cannot differentiate between debug or release configurations within
643
+ # that phase.
644
+ frameworks.concat target.dependent_targets_by_config[@configuration].flat_map { |pt| pt.build_settings[@configuration].dynamic_frameworks_to_import }
645
+ else
646
+ # Also include any vendored dynamic frameworks of dependencies.
647
+ frameworks.concat dependent_targets.reject(&:should_build?).flat_map { |pt| pt.build_settings[@configuration].dynamic_frameworks_to_import }
619
648
  end
620
- # Also include any vendored dynamic frameworks of dependencies.
621
- frameworks.concat dependent_targets.reject(&:should_build?).flat_map { |pt| pt.build_settings[@configuration].dynamic_frameworks_to_import }
622
649
  else
623
650
  frameworks.concat dependent_targets_to_link.flat_map { |pt| pt.build_settings[@configuration].frameworks_to_import }
624
651
  end
@@ -721,7 +748,9 @@ module Pod
721
748
 
722
749
  # @return [Array<Xcode::XCFramework>]
723
750
  define_build_settings_method :vendored_xcframeworks, :memoized => true do
724
- file_accessors.flat_map(&:vendored_xcframeworks).map { |path| load_xcframework(path) }
751
+ file_accessors.flat_map do |file_accessor|
752
+ file_accessor.vendored_xcframeworks.map { |path| load_xcframework(file_accessor.spec.name, path) }
753
+ end
725
754
  end
726
755
 
727
756
  # @return [Array<String>]
@@ -840,10 +869,15 @@ module Pod
840
869
 
841
870
  # @return [Array<String>]
842
871
  define_build_settings_method :library_search_paths_to_import, :memoized => true do
843
- vendored_library_search_paths = vendored_static_library_search_paths + vendored_dynamic_library_search_paths
844
- return vendored_library_search_paths if target.build_as_framework? || !target.should_build?
872
+ search_paths = vendored_static_library_search_paths + vendored_dynamic_library_search_paths
873
+ if target.uses_swift? || other_swift_flags_without_swift?
874
+ search_paths << '/usr/lib/swift'
875
+ search_paths << '${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}'
876
+ search_paths << '$(PLATFORM_DIR)/Developer/Library/Frameworks' if test_xcconfig?
877
+ end
878
+ return search_paths if target.build_as_framework? || !target.should_build?
845
879
 
846
- vendored_library_search_paths << target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
880
+ search_paths << target.configuration_build_dir(CONFIGURATION_BUILD_DIR_VARIABLE)
847
881
  end
848
882
 
849
883
  #-------------------------------------------------------------------------#
@@ -915,6 +949,8 @@ module Pod
915
949
  define_build_settings_method :swift_include_paths, :build_setting => true, :memoized => true, :sorted => true, :uniqued => true do
916
950
  paths = dependent_targets.flat_map { |pt| pt.build_settings[@configuration].swift_include_paths_to_import }
917
951
  paths.concat swift_include_paths_to_import if non_library_xcconfig?
952
+ vendored_static_library_search_paths = dependent_targets.flat_map { |pt| pt.build_settings[@configuration].vendored_static_library_search_paths }
953
+ paths.concat vendored_static_library_search_paths
918
954
  paths.concat ['$(PLATFORM_DIR)/Developer/usr/lib'] if should_apply_xctunwrap_fix?
919
955
  paths
920
956
  end
@@ -948,7 +984,8 @@ module Pod
948
984
  # @return [Array<String>]
949
985
  define_build_settings_method :ld_runpath_search_paths, :build_setting => true, :memoized => true do
950
986
  return if library_xcconfig?
951
- _ld_runpath_search_paths(:test_bundle => test_xcconfig?)
987
+ _ld_runpath_search_paths(:test_bundle => test_xcconfig?,
988
+ :uses_swift => other_swift_flags_without_swift? || dependent_targets.any?(&:uses_swift?))
952
989
  end
953
990
 
954
991
  #-------------------------------------------------------------------------#
@@ -1202,6 +1239,13 @@ module Pod
1202
1239
  flags
1203
1240
  end
1204
1241
 
1242
+ # @return [Array<String>]
1243
+ define_build_settings_method :other_module_verifier_flags, :memoized => true do
1244
+ flags = super()
1245
+ flags += pod_targets.map { |pt| '-F' + pt.build_settings[@configuration].configuration_build_dir }
1246
+ flags
1247
+ end
1248
+
1205
1249
  # @return [Array<String>]
1206
1250
  define_build_settings_method :module_map_files, :memoized => true, :sorted => true, :uniqued => true, :compacted => true, :from_search_paths_aggregate_targets => :module_map_file_to_import do
1207
1251
  pod_targets.map { |pt| pt.build_settings[@configuration].module_map_file_to_import }
@@ -1251,14 +1295,15 @@ module Pod
1251
1295
  return unless pod_targets.any?(&:build_as_dynamic?) || any_vendored_dynamic_artifacts?
1252
1296
  symbol_type = target.user_targets.map(&:symbol_type).uniq.first
1253
1297
  test_bundle = symbol_type == :octest_bundle || symbol_type == :unit_test_bundle || symbol_type == :ui_test_bundle
1254
- _ld_runpath_search_paths(:requires_host_target => target.requires_host_target?, :test_bundle => test_bundle)
1298
+ _ld_runpath_search_paths(:requires_host_target => target.requires_host_target?, :test_bundle => test_bundle,
1299
+ :uses_swift => pod_targets.any?(&:uses_swift?))
1255
1300
  end
1256
1301
 
1257
1302
  # @return [Boolean]
1258
1303
  define_build_settings_method :any_vendored_dynamic_artifacts?, :memoized => true do
1259
1304
  pod_targets.any? do |pt|
1260
1305
  pt.file_accessors.any? do |fa|
1261
- !fa.vendored_dynamic_artifacts.empty?
1306
+ !fa.vendored_dynamic_artifacts.empty? || !fa.vendored_dynamic_xcframeworks.empty?
1262
1307
  end
1263
1308
  end
1264
1309
  end
@@ -203,7 +203,7 @@ module Pod
203
203
  end
204
204
  end
205
205
 
206
- # @return [Array<FileAccessor>] The list of all files tracked.
206
+ # @return [Array<Pathname>] The list of all files tracked.
207
207
  #
208
208
  def all_files
209
209
  Sandbox::FileAccessor.all_files(file_accessors)
@@ -268,7 +268,24 @@ module Pod
268
268
  root_spec.module_name
269
269
  end
270
270
 
271
- # @return [Bool] Whether or not this target should be built.
271
+ # @param [Specification] spec the specification
272
+ #
273
+ # @return [String] the product basename of the specification's target
274
+ def product_basename_for_spec(spec)
275
+ user_specified = build_settings_by_config_for_spec(spec).
276
+ each_value.
277
+ map { |settings| settings.merged_pod_target_xcconfigs['PRODUCT_NAME'] }.
278
+ compact.
279
+ uniq
280
+
281
+ if user_specified.size == 1
282
+ user_specified.first
283
+ else
284
+ spec_label(spec)
285
+ end
286
+ end
287
+
288
+ # @return [Boolean] Whether or not this target should be built.
272
289
  #
273
290
  # A target should not be built if it has no source files.
274
291
  #
@@ -294,22 +311,26 @@ module Pod
294
311
  test_specs.map { |test_spec| test_spec.consumer(platform) }
295
312
  end
296
313
 
297
- # @return [Array<Specification::Consumer>] the test specification consumers for
314
+ # @return [Array<Specification::Consumer>] the app specification consumers for
298
315
  # the target.
299
316
  #
300
317
  def app_spec_consumers
301
318
  app_specs.map { |app_spec| app_spec.consumer(platform) }
302
319
  end
303
320
 
304
- # @return [Boolean] Whether the target uses Swift code. This excludes source files from non library specs.
321
+ # Checks whether the target itself plus its specs uses Swift code.
322
+ # This check excludes source files from non library specs.
323
+ # Note that if a target does not need to be built (no source code),
324
+ # we fallback to check whether it indicates a swift version.
325
+ #
326
+ # @return [Boolean] Whether the target uses Swift code.
305
327
  #
306
328
  def uses_swift?
307
329
  return @uses_swift if defined? @uses_swift
308
- @uses_swift = begin
330
+ @uses_swift = (!should_build? && !spec_swift_versions.empty?) ||
309
331
  file_accessors.select { |a| a.spec.library_specification? }.any? do |file_accessor|
310
332
  uses_swift_for_spec?(file_accessor.spec)
311
333
  end
312
- end
313
334
  end
314
335
 
315
336
  # Checks whether a specification uses Swift or not.
@@ -373,7 +394,7 @@ module Pod
373
394
  !test_specs.empty?
374
395
  end
375
396
 
376
- # @return [Boolean] Whether the target has any tests specifications.
397
+ # @return [Boolean] Whether the target has any app specifications.
377
398
  #
378
399
  def contains_app_specifications?
379
400
  !app_specs.empty?
@@ -422,7 +443,7 @@ module Pod
422
443
  @xcframeworks ||= begin
423
444
  file_accessors.each_with_object({}) do |file_accessor, hash|
424
445
  frameworks = file_accessor.vendored_xcframeworks.map do |framework_path|
425
- Xcode::XCFramework.new(framework_path)
446
+ Xcode::XCFramework.new(file_accessor.spec.name, framework_path)
426
447
  end
427
448
  hash[file_accessor.spec.name] = frameworks
428
449
  end
@@ -455,7 +476,7 @@ module Pod
455
476
  prefix = Pod::Target::BuildSettings::CONFIGURATION_BUILD_DIR_VARIABLE
456
477
  prefix = configuration_build_dir unless file_accessor.spec.test_specification?
457
478
  resource_bundle_paths = file_accessor.resource_bundles.keys.map { |name| "#{prefix}/#{name.shellescape}.bundle" }
458
- hash[file_accessor.spec.name] = resource_paths + resource_bundle_paths
479
+ hash[file_accessor.spec.name] = (resource_paths + resource_bundle_paths).map(&:to_s)
459
480
  end
460
481
  end
461
482
  end
@@ -512,7 +533,7 @@ module Pod
512
533
  # @return [Specification] The root specification for the target.
513
534
  #
514
535
  def root_spec
515
- specs.first.root
536
+ @root_spec ||= specs.first.root
516
537
  end
517
538
 
518
539
  # @return [String] The name of the Pod that this target refers to.
@@ -619,13 +640,16 @@ module Pod
619
640
  end
620
641
  end
621
642
 
622
- def non_library_spec_label(spec)
643
+ def spec_label(spec)
623
644
  case spec.spec_type
645
+ when :library then label
624
646
  when :test then test_target_label(spec)
625
647
  when :app then app_target_label(spec)
626
648
  else raise ArgumentError, "Unhandled spec type #{spec.spec_type.inspect} for #{spec.inspect}"
627
649
  end
628
650
  end
651
+ # for backwards compatibility
652
+ alias non_library_spec_label spec_label
629
653
 
630
654
  # @param [Specification] spec
631
655
  # The spec to return scheme configuration for.
@@ -645,7 +669,7 @@ module Pod
645
669
  # @return [Pathname] The absolute path of the copy resources script for the given spec.
646
670
  #
647
671
  def copy_resources_script_path_for_spec(spec)
648
- support_files_dir + "#{non_library_spec_label(spec)}-resources.sh"
672
+ support_files_dir + "#{spec_label(spec)}-resources.sh"
649
673
  end
650
674
 
651
675
  # @param [Specification] spec
@@ -654,7 +678,7 @@ module Pod
654
678
  # @return [Pathname] The absolute path of the copy resources script input file list for the given spec.
655
679
  #
656
680
  def copy_resources_script_input_files_path_for_spec(spec)
657
- support_files_dir + "#{non_library_spec_label(spec)}-resources-input-files.xcfilelist"
681
+ support_files_dir + "#{spec_label(spec)}-resources-input-files.xcfilelist"
658
682
  end
659
683
 
660
684
  # @param [Specification] spec
@@ -663,7 +687,7 @@ module Pod
663
687
  # @return [Pathname] The absolute path of the copy resources script output file list for the given spec.
664
688
  #
665
689
  def copy_resources_script_output_files_path_for_spec(spec)
666
- support_files_dir + "#{non_library_spec_label(spec)}-resources-output-files.xcfilelist"
690
+ support_files_dir + "#{spec_label(spec)}-resources-output-files.xcfilelist"
667
691
  end
668
692
 
669
693
  # @param [Specification] spec
@@ -672,7 +696,7 @@ module Pod
672
696
  # @return [Pathname] The absolute path of the embed frameworks script for the given spec.
673
697
  #
674
698
  def embed_frameworks_script_path_for_spec(spec)
675
- support_files_dir + "#{non_library_spec_label(spec)}-frameworks.sh"
699
+ support_files_dir + "#{spec_label(spec)}-frameworks.sh"
676
700
  end
677
701
 
678
702
  # @param [Specification] spec
@@ -681,7 +705,7 @@ module Pod
681
705
  # @return [Pathname] The absolute path of the embed frameworks script input file list for the given spec.
682
706
  #
683
707
  def embed_frameworks_script_input_files_path_for_spec(spec)
684
- support_files_dir + "#{non_library_spec_label(spec)}-frameworks-input-files.xcfilelist"
708
+ support_files_dir + "#{spec_label(spec)}-frameworks-input-files.xcfilelist"
685
709
  end
686
710
 
687
711
  # @param [Specification] spec
@@ -690,7 +714,7 @@ module Pod
690
714
  # @return [Pathname] The absolute path of the embed frameworks script output file list for the given spec.
691
715
  #
692
716
  def embed_frameworks_script_output_files_path_for_spec(spec)
693
- support_files_dir + "#{non_library_spec_label(spec)}-frameworks-output-files.xcfilelist"
717
+ support_files_dir + "#{spec_label(spec)}-frameworks-output-files.xcfilelist"
694
718
  end
695
719
 
696
720
  # @return [Pathname] The absolute path of the copy xcframeworks script.
@@ -721,7 +745,7 @@ module Pod
721
745
  # @todo Remove in 2.0
722
746
  #
723
747
  def prepare_artifacts_script_path_for_spec(spec)
724
- support_files_dir + "#{non_library_spec_label(spec)}-artifacts.sh"
748
+ support_files_dir + "#{spec_label(spec)}-artifacts.sh"
725
749
  end
726
750
 
727
751
  # @param [Specification] spec
@@ -734,7 +758,7 @@ module Pod
734
758
  # @todo Remove in 2.0
735
759
  #
736
760
  def prepare_artifacts_script_input_files_path_for_spec(spec)
737
- support_files_dir + "#{non_library_spec_label(spec)}-artifacts-input-files.xcfilelist"
761
+ support_files_dir + "#{spec_label(spec)}-artifacts-input-files.xcfilelist"
738
762
  end
739
763
 
740
764
  # @param [Specification] spec
@@ -747,7 +771,7 @@ module Pod
747
771
  # @todo Remove in 2.0
748
772
  #
749
773
  def prepare_artifacts_script_output_files_path_for_spec(spec)
750
- support_files_dir + "#{non_library_spec_label(spec)}-artifacts-output-files.xcfilelist"
774
+ support_files_dir + "#{spec_label(spec)}-artifacts-output-files.xcfilelist"
751
775
  end
752
776
 
753
777
  # @return [Pathname] The absolute path of the copy dSYMs script.
@@ -774,7 +798,7 @@ module Pod
774
798
  # @return [Pathname] The absolute path of the Info.plist for the given spec.
775
799
  #
776
800
  def info_plist_path_for_spec(spec)
777
- support_files_dir + "#{non_library_spec_label(spec)}-Info.plist"
801
+ support_files_dir + "#{spec_label(spec)}-Info.plist"
778
802
  end
779
803
 
780
804
  # @param [Specification] spec
@@ -783,7 +807,7 @@ module Pod
783
807
  # @return [Pathname] the absolute path of the prefix header file for the given spec.
784
808
  #
785
809
  def prefix_header_path_for_spec(spec)
786
- support_files_dir + "#{non_library_spec_label(spec)}-prefix.pch"
810
+ support_files_dir + "#{spec_label(spec)}-prefix.pch"
787
811
  end
788
812
 
789
813
  # @return [Array<String>] The names of the Pods on which this target
@@ -923,7 +947,7 @@ module Pod
923
947
 
924
948
  # Checks if warnings should be inhibited for this pod.
925
949
  #
926
- # @return [Bool]
950
+ # @return [Boolean]
927
951
  #
928
952
  def inhibit_warnings?
929
953
  return @inhibit_warnings if defined? @inhibit_warnings
@@ -1054,7 +1078,8 @@ module Pod
1054
1078
  #
1055
1079
  def uses_modular_headers?(only_if_defines_modules = true)
1056
1080
  return false if only_if_defines_modules && !defines_module?
1057
- spec_consumers.none?(&:header_mappings_dir) && spec_consumers.none?(&:header_dir)
1081
+ return @uses_modular_headers if defined? @uses_modular_headers
1082
+ @uses_modular_headers = spec_consumers.none?(&:header_mappings_dir) && spec_consumers.none?(&:header_dir)
1058
1083
  end
1059
1084
 
1060
1085
  private
@@ -350,7 +350,7 @@ module Pod
350
350
  end
351
351
 
352
352
  def self.resource_extension_compilable?(input_extension)
353
- output_extension_for_resource(input_extension) != input_extension
353
+ output_extension_for_resource(input_extension) != input_extension && input_extension != '.xcassets'
354
354
  end
355
355
 
356
356
  #-------------------------------------------------------------------------#