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
@@ -43,18 +43,14 @@ module Pod
43
43
  test_file_accessors = target.file_accessors.select { |fa| fa.spec.test_specification? }
44
44
  app_file_accessors = target.file_accessors.select { |fa| fa.spec.app_specification? }
45
45
 
46
- unless target.should_build?
47
- # For targets that should not be built (e.g. pre-built vendored frameworks etc), we add a placeholder
48
- # PBXAggregateTarget that will be used to wire up dependencies later.
49
- native_target = add_placeholder_target
50
- resource_bundle_targets = add_resources_bundle_targets(library_file_accessors).values.flatten
51
- create_copy_dsyms_script
52
- create_copy_xcframeworks_script unless target.xcframeworks.values.all?(&:empty?)
53
- create_xcconfig_file(native_target, resource_bundle_targets)
54
- return TargetInstallationResult.new(target, native_target, resource_bundle_targets)
55
- end
46
+ native_target = if target.should_build?
47
+ add_target
48
+ else
49
+ # For targets that should not be built (e.g. pre-built vendored frameworks etc), we add a placeholder
50
+ # PBXAggregateTarget that will be used to wire up dependencies later.
51
+ add_placeholder_target
52
+ end
56
53
 
57
- native_target = add_target
58
54
  resource_bundle_targets = add_resources_bundle_targets(library_file_accessors).values.flatten
59
55
 
60
56
  test_native_targets = add_test_targets
@@ -65,8 +61,10 @@ module Pod
65
61
  app_resource_bundle_targets = add_resources_bundle_targets(app_file_accessors)
66
62
 
67
63
  add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
68
- validate_targets_contain_sources(test_native_targets + app_native_targets.values + [native_target])
69
- validate_xcframeworks
64
+ targets_to_validate = test_native_targets + app_native_targets.values
65
+ targets_to_validate << native_target if target.should_build?
66
+ validate_targets_contain_sources(targets_to_validate)
67
+ validate_xcframeworks if target.should_build?
70
68
 
71
69
  create_copy_xcframeworks_script unless target.xcframeworks.values.all?(&:empty?)
72
70
 
@@ -74,7 +72,7 @@ module Pod
74
72
  create_test_xcconfig_files(test_native_targets, test_resource_bundle_targets)
75
73
  create_app_xcconfig_files(app_native_targets, app_resource_bundle_targets)
76
74
 
77
- if target.defines_module?
75
+ if target.should_build? && target.defines_module? && !skip_modulemap?(target.library_specs)
78
76
  create_module_map(native_target) do |generator|
79
77
  generator.headers.concat module_map_additional_headers
80
78
  end
@@ -99,20 +97,21 @@ module Pod
99
97
  end
100
98
  end
101
99
 
102
- if target.build_as_framework?
100
+ if target.should_build? && target.build_as_framework?
103
101
  unless skip_info_plist?(native_target)
104
- create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform, :additional_entries => target.info_plist_entries)
102
+ create_info_plist_file(target.info_plist_path, native_target, target.version, target.platform,
103
+ :additional_entries => target.info_plist_entries)
105
104
  end
106
105
  create_build_phase_to_symlink_header_folders(native_target)
107
106
  end
108
107
 
109
- if target.build_as_library? && target.uses_swift?
108
+ if target.should_build? && target.build_as_library? && target.uses_swift?
110
109
  add_swift_library_compatibility_header_phase(native_target)
111
110
  end
112
111
 
113
112
  project_directory = project.path.dirname
114
113
 
115
- unless skip_pch?(target.library_specs)
114
+ if target.should_build? && !skip_pch?(target.library_specs)
116
115
  path = target.prefix_header_path
117
116
  create_prefix_header(path, library_file_accessors, target.platform, native_target, project_directory)
118
117
  add_file_to_support_group(path)
@@ -135,7 +134,7 @@ module Pod
135
134
  add_file_to_support_group(path)
136
135
  end
137
136
  end
138
- create_dummy_source(native_target)
137
+ create_dummy_source(native_target) if target.should_build?
139
138
  create_copy_dsyms_script
140
139
  clean_support_files_temp_dir
141
140
  TargetInstallationResult.new(target, native_target, resource_bundle_targets,
@@ -191,6 +190,10 @@ module Pod
191
190
  specs.any? { |spec| spec.root.prefix_header_file.is_a?(FalseClass) }
192
191
  end
193
192
 
193
+ def skip_modulemap?(specs)
194
+ specs.any? { |spec| spec.module_map.is_a?(FalseClass) }
195
+ end
196
+
194
197
  # True if info.plist generation should be skipped
195
198
  #
196
199
  # @param [PXNativeTarget] native_target
@@ -223,6 +226,11 @@ module Pod
223
226
 
224
227
  settings['SWIFT_ACTIVE_COMPILATION_CONDITIONS'] = '$(inherited) '
225
228
 
229
+ # Added in Xcode 16. We manually generate our own Info.plist file so opt out.
230
+ settings['GENERATE_INFOPLIST_FILE'] = 'NO'
231
+ # Added in Xcode 16. For Swift-only Pods to be visible to Objective-C we to enable this.
232
+ settings['SWIFT_INSTALL_OBJC_HEADER'] = 'YES'
233
+
226
234
  if target.swift_version
227
235
  settings['SWIFT_VERSION'] = target.swift_version
228
236
  end
@@ -242,7 +250,7 @@ module Pod
242
250
  @plist_bundle_id = target.info_plist_entries['CFBundleIdentifier']
243
251
  unless @plist_bundle_id.nil?
244
252
  message = "The `#{target.name}` target " \
245
- "sets a Bundle Identifier of `#{@plist_bundle_id}` in it's info.plist file. " \
253
+ "sets a Bundle Identifier of `#{@plist_bundle_id}` in its info.plist file. " \
246
254
  'The Bundle Identifier should be set using pod_target_xcconfig: ' \
247
255
  "s.pod_target_xcconfig = { 'PRODUCT_BUNDLE_IDENTIFIER': '#{@plist_bundle_id}' }`."
248
256
  UI.warn message
@@ -264,10 +272,10 @@ module Pod
264
272
  # @yield_param [Array<PBXFileReference>} The filtered resource file references to be installed
265
273
  # in the compile sources phase.
266
274
  #
267
- # @note Core Data model directories (.xcdatamodeld) used to be added to the
268
- # `Copy Resources` build phase like all other resources, since they would
269
- # compile correctly in either the resources or compile phase. In recent
270
- # versions of xcode, there's an exception for data models that generate
275
+ # @note Core Data model directories (.xcdatamodeld) and RealityKit projects (.rcproject)
276
+ # used to be added to the `Copy Resources` build phase like all other resources,
277
+ # since they would compile correctly in either the resources or compile phase. In
278
+ # recent versions of xcode, there's an exception for data models that generate
271
279
  # headers. These need to be added to the compile sources phase of a real
272
280
  # target for the headers to be built in time for code in the target to
273
281
  # use them. These kinds of models generally break when added to resource
@@ -287,7 +295,7 @@ module Pod
287
295
 
288
296
  ref
289
297
  end.compact.uniq
290
- compile_phase_matcher = lambda { |ref| !(ref.path =~ /.*\.xcdatamodeld/i).nil? }
298
+ compile_phase_matcher = lambda { |ref| !(ref.path =~ /.*\.(xcdatamodeld|rcproject)/i).nil? }
291
299
  compile_phase_refs, resources_phase_refs = file_references.partition(&compile_phase_matcher)
292
300
  yield compile_phase_refs, resources_phase_refs
293
301
  end
@@ -307,21 +315,26 @@ module Pod
307
315
  #
308
316
  # @return [void]
309
317
  #
310
- def add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
318
+ def add_files_to_build_phases(library_native_target, test_native_targets, app_native_targets)
311
319
  target.file_accessors.each do |file_accessor|
312
320
  consumer = file_accessor.spec_consumer
313
321
 
314
322
  native_target = case consumer.spec.spec_type
315
323
  when :library
316
- native_target
324
+ library_native_target
317
325
  when :test
318
326
  test_native_target_from_spec(consumer.spec, test_native_targets)
319
327
  when :app
320
328
  app_native_targets[consumer.spec]
329
+ else
330
+ raise ArgumentError, "Unknown spec type #{consumer.spec.spec_type}."
321
331
  end
322
332
 
333
+ next if native_target.is_a?(Xcodeproj::Project::Object::PBXAggregateTarget)
334
+
323
335
  headers = file_accessor.headers
324
336
  public_headers = file_accessor.public_headers.map(&:realpath)
337
+ project_headers = file_accessor.project_headers.map(&:realpath)
325
338
  private_headers = file_accessor.private_headers.map(&:realpath)
326
339
  other_source_files = file_accessor.other_source_files
327
340
 
@@ -344,7 +357,7 @@ module Pod
344
357
 
345
358
  header_file_refs = project_file_references_array(headers, 'header')
346
359
  native_target.add_file_references(header_file_refs) do |build_file|
347
- add_header(file_accessor, build_file, public_headers, private_headers, native_target)
360
+ add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
348
361
  end
349
362
 
350
363
  other_file_refs = project_file_references_array(other_source_files, 'other source')
@@ -356,7 +369,10 @@ module Pod
356
369
  native_target.add_file_references(compile_phase_refs, nil)
357
370
 
358
371
  if target.build_as_static_framework? && consumer.spec.library_specification?
359
- resource_phase_refs = resource_phase_refs.select { |ref| Target.resource_extension_compilable?(File.extname(ref.path)) }
372
+ resource_phase_refs = resource_phase_refs.select do |ref|
373
+ filename = ref.name || ref.path
374
+ Target.resource_extension_compilable?(File.extname(filename))
375
+ end
360
376
  end
361
377
 
362
378
  native_target.add_resources(resource_phase_refs)
@@ -377,9 +393,11 @@ module Pod
377
393
  name = target.test_target_label(test_spec)
378
394
  platform_name = target.platform.name
379
395
  language = target.uses_swift_for_spec?(test_spec) ? :swift : :objc
396
+ product_basename = target.product_basename_for_spec(test_spec)
397
+ embedded_content_contains_swift = target.dependent_targets_for_test_spec(test_spec).any?(&:uses_swift?)
380
398
  test_native_target = project.new_target(product_type, name, platform_name,
381
399
  target.deployment_target_for_non_library_spec(test_spec), nil,
382
- language)
400
+ language, product_basename)
383
401
  test_native_target.product_reference.name = name
384
402
 
385
403
  target.user_build_configurations.each do |bc_name, type|
@@ -413,6 +431,9 @@ module Pod
413
431
  elsif target.platform == :ios
414
432
  configuration.build_settings['CODE_SIGN_IDENTITY'] = 'iPhone Developer'
415
433
  end
434
+ # Ensure swift stdlib gets copied in if needed, even when the target contains no swift files,
435
+ # because a dependency uses swift
436
+ configuration.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES' if embedded_content_contains_swift
416
437
  end
417
438
 
418
439
  remove_pod_target_xcconfig_overrides_from_target(target.test_spec_build_settings_by_config[test_spec.name], test_native_target)
@@ -463,10 +484,12 @@ module Pod
463
484
  info_plist_entries = spec_consumer.info_plist
464
485
  resources = target.file_accessors.find { |fa| fa.spec == app_spec }.resources
465
486
  add_launchscreen_storyboard = resources.none? { |resource| resource.basename.to_s == 'LaunchScreen.storyboard' } && platform.name == :ios
487
+ embedded_content_contains_swift = target.dependent_targets_for_app_spec(app_spec).any?(&:uses_swift?)
466
488
  app_native_target = AppHostInstaller.new(sandbox, project, platform, subspec_name, spec_name,
467
489
  app_target_label, :add_main => false,
468
490
  :add_launchscreen_storyboard => add_launchscreen_storyboard,
469
- :info_plist_entries => info_plist_entries).install!
491
+ :info_plist_entries => info_plist_entries,
492
+ :product_basename => target.product_basename_for_spec(app_spec)).install!
470
493
 
471
494
  app_native_target.product_reference.name = app_target_label
472
495
  target.user_build_configurations.each do |bc_name, type|
@@ -505,6 +528,9 @@ module Pod
505
528
  configuration.build_settings.delete('CODE_SIGN_IDENTITY[sdk=iphoneos*]')
506
529
  configuration.build_settings.delete('CODE_SIGN_IDENTITY[sdk=watchos*]')
507
530
  end
531
+ # Ensure swift stdlib gets copied in if needed, even when the target contains no swift files,
532
+ # because a dependency uses swift
533
+ configuration.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES' if embedded_content_contains_swift
508
534
  end
509
535
 
510
536
  remove_pod_target_xcconfig_overrides_from_target(target.app_spec_build_settings_by_config[app_spec.name], app_native_target)
@@ -548,12 +574,8 @@ module Pod
548
574
  file_accessors.each_with_object({}) do |file_accessor, hash|
549
575
  hash[file_accessor.spec.name] = file_accessor.resource_bundles.map do |bundle_name, paths|
550
576
  label = target.resources_bundle_target_label(bundle_name)
551
- resource_bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name)
552
- resource_bundle_target.product_reference.tap do |bundle_product|
553
- bundle_file_name = "#{bundle_name}.bundle"
554
- bundle_product.name = bundle_file_name
555
- end
556
-
577
+ resource_bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name, nil, bundle_name)
578
+ resource_bundle_target.product_reference.name = label
557
579
  contains_compile_phase_refs = add_resources_to_target(paths, resource_bundle_target)
558
580
 
559
581
  target.user_build_configurations.each do |bc_name, type|
@@ -583,6 +605,9 @@ module Pod
583
605
  # classes from the parent module.
584
606
  configuration.build_settings['IBSC_MODULE'] = target.product_module_name
585
607
 
608
+ # Xcode 14.x throws an error about code signing on resource bundles, turn it off for now.
609
+ configuration.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
610
+
586
611
  # Set the `SWIFT_VERSION` build setting for resource bundles that could have resources that get
587
612
  # compiled such as an `xcdatamodeld` file which has 'Swift' as its code generation language.
588
613
  if contains_compile_phase_refs && file_accessors.any? { |fa| target.uses_swift_for_spec?(fa.spec) }
@@ -655,10 +680,6 @@ module Pod
655
680
  scoped_test_resource_bundle_targets = test_resource_bundle_targets[test_spec.name]
656
681
  apply_xcconfig_file_ref_to_targets([test_native_target] + scoped_test_resource_bundle_targets, test_xcconfig_file_ref, names)
657
682
  end
658
-
659
- test_native_target.build_configurations.each do |test_native_target_bc|
660
- test_target_swift_debug_hack(test_spec, test_native_target_bc)
661
- end
662
683
  end
663
684
  end
664
685
 
@@ -837,20 +858,8 @@ module Pod
837
858
  add_file_to_support_group(path)
838
859
  end
839
860
 
840
- # Manually add `libswiftSwiftOnoneSupport.dylib` as it seems there is an issue with tests that do not include it for Debug configurations.
841
- # Possibly related to Swift module optimization.
842
- #
843
- # @return [void]
844
- #
845
- def test_target_swift_debug_hack(test_spec, test_target_bc)
846
- return unless test_target_bc.debug?
847
- return unless target.dependent_targets_for_test_spec(test_spec).any?(&:uses_swift?)
848
- ldflags = test_target_bc.build_settings['OTHER_LDFLAGS'] ||= '$(inherited)'
849
- ldflags << ' -lswiftSwiftOnoneSupport'
850
- end
851
-
852
861
  # Creates a build phase which links the versioned header folders
853
- # of the OS X into the framework bundle's root root directory.
862
+ # of the OS X framework into the framework bundle's root directory.
854
863
  # This is only necessary because the way how headers are copied
855
864
  # via custom copy file build phases in combination with
856
865
  # header_mappings_dir interferes with xcodebuild's expectations
@@ -862,11 +871,16 @@ module Pod
862
871
  # @return [void]
863
872
  #
864
873
  def create_build_phase_to_symlink_header_folders(native_target)
865
- return unless target.platform.name == :osx && any_header_mapping_dirs?
874
+ # This is required on iOS for Catalyst, which uses macOS framework layouts
875
+ return unless (target.platform.name == :osx || target.platform.name == :ios) && any_header_mapping_dirs?
866
876
 
867
877
  build_phase = native_target.new_shell_script_build_phase('Create Symlinks to Header Folders')
868
878
  build_phase.shell_script = <<-eos.strip_heredoc
869
879
  cd "$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME" || exit 1
880
+ if [ ! -d Versions ]; then
881
+ # Not a versioned framework, so no need to do anything
882
+ exit 0
883
+ fi
870
884
 
871
885
  public_path="${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}"
872
886
  if [ ! -f "$public_path" ]; then
@@ -885,6 +899,7 @@ module Pod
885
899
  :osx => Version.new('10.8'),
886
900
  :watchos => Version.new('2.0'),
887
901
  :tvos => Version.new('9.0'),
902
+ :visionos => Version.new('1.0'),
888
903
  }.freeze
889
904
 
890
905
  # Returns the compiler flags for the source files of the given specification.
@@ -993,7 +1008,7 @@ module Pod
993
1008
  end
994
1009
 
995
1010
  def create_umbrella_header(native_target)
996
- return super(native_target) unless custom_module_map
1011
+ super(native_target) unless custom_module_map
997
1012
  end
998
1013
 
999
1014
  def custom_module_map
@@ -1004,6 +1019,9 @@ module Pod
1004
1019
  error_message_for_missing_reference = lambda do |sf, target|
1005
1020
  "Unable to find #{file_type} ref for `#{sf.basename}` for target `#{target.name}`."
1006
1021
  end
1022
+
1023
+ # Remove all file ref under .docc folder, but preserve the .docc folder
1024
+ files = merge_to_docc_folder(files)
1007
1025
  files.map do |sf|
1008
1026
  begin
1009
1027
  project.reference_for_path(sf).tap do |ref|
@@ -1030,12 +1048,14 @@ module Pod
1030
1048
  end
1031
1049
  end
1032
1050
 
1033
- def add_header(file_accessor, build_file, public_headers, private_headers, native_target)
1051
+ def add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
1034
1052
  file_ref = build_file.file_ref
1035
1053
  acl = if !target.build_as_framework? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
1036
1054
  'Project'
1037
1055
  elsif public_headers.include?(file_ref.real_path)
1038
1056
  'Public'
1057
+ elsif project_headers.include?(file_ref.real_path)
1058
+ 'Project'
1039
1059
  elsif private_headers.include?(file_ref.real_path)
1040
1060
  'Private'
1041
1061
  else
@@ -1088,6 +1108,9 @@ module Pod
1088
1108
  target.user_build_configurations.each do |bc_name, type|
1089
1109
  native_target.add_build_configuration(bc_name, type)
1090
1110
  end
1111
+ native_target.build_configurations.each do |configuration|
1112
+ configuration.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
1113
+ end
1091
1114
  unless target.archs.empty?
1092
1115
  native_target.build_configurations.each do |configuration|
1093
1116
  configuration.build_settings['ARCHS'] = target.archs
@@ -1191,7 +1214,11 @@ module Pod
1191
1214
  def dsym_paths(target)
1192
1215
  dsym_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.dsym_path.nil? }.map(&:dsym_path)
1193
1216
  dsym_paths.concat(target.xcframeworks.values.flatten.flat_map { |xcframework| xcframework_dsyms(xcframework.path) })
1194
- dsym_paths
1217
+ dsym_paths.map do |dsym_path|
1218
+ dsym_pathname = Pathname(dsym_path)
1219
+ dsym_path = "${PODS_ROOT}/#{dsym_pathname.relative_path_from(target.sandbox.root)}" unless dsym_pathname.relative?
1220
+ dsym_path
1221
+ end
1195
1222
  end
1196
1223
 
1197
1224
  # @param [PodTarget] target the target to be installed
@@ -1201,7 +1228,7 @@ module Pod
1201
1228
  def bcsymbolmap_paths(target)
1202
1229
  target.framework_paths.values.flatten.reject do |fmwk_path|
1203
1230
  fmwk_path.bcsymbolmap_paths.nil?
1204
- end.flat_map(&:bcsymbolmap_paths)
1231
+ end.flat_map(&:bcsymbolmap_paths).uniq
1205
1232
  end
1206
1233
 
1207
1234
  # @param [Pathname] xcframework_path
@@ -34,6 +34,7 @@ module Pod
34
34
  target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|
35
35
  add_embed_frameworks_script_phase(native_target, spec)
36
36
  add_copy_resources_script_phase(native_target, spec)
37
+ add_on_demand_resources(native_target, spec) if spec.app_specification?
37
38
  UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)
38
39
  end
39
40
  add_copy_dsyms_script_phase(target_installation_result.native_target)
@@ -134,20 +135,26 @@ module Pod
134
135
  spec_paths_to_include << spec.name if dependent_target == target
135
136
  dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact
136
137
  end.uniq
138
+ xcframework_paths = dependent_targets.flat_map do |dependent_target|
139
+ spec_paths_to_include = dependent_target.library_specs.map(&:name)
140
+ spec_paths_to_include -= host_target_spec_names
141
+ spec_paths_to_include << spec.name if dependent_target == target
142
+ dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact
143
+ end.uniq
137
144
 
138
- if use_input_output_paths? && !framework_paths.empty?
145
+ if use_input_output_paths? && !framework_paths.empty? || !xcframework_paths.empty?
139
146
  input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)
140
147
  input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
141
148
  input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
142
- input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, [])
149
+ input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, xcframework_paths)
143
150
 
144
151
  output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)
145
152
  output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
146
153
  output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
147
- output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, [])
154
+ output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, xcframework_paths)
148
155
  end
149
156
 
150
- if framework_paths.empty?
157
+ if framework_paths.empty? && xcframework_paths.empty?
151
158
  UserProjectIntegrator::TargetIntegrator.remove_embed_frameworks_script_phase_from_target(native_target)
152
159
  else
153
160
  UserProjectIntegrator::TargetIntegrator.create_or_update_embed_frameworks_script_phase_to_target(
@@ -183,7 +190,7 @@ module Pod
183
190
  output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
184
191
  output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
185
192
  output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|
186
- "#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.name}"
193
+ "#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.target_name}/#{xcf.name}.framework"
187
194
  end
188
195
  end
189
196
 
@@ -199,7 +206,7 @@ module Pod
199
206
  # vendored dSYMs.
200
207
  #
201
208
  # @param [PBXNativeTarget] native_target
202
- # the native target for which to add the the copy dSYM files build phase.
209
+ # the native target for which to add the copy dSYM files build phase.
203
210
  #
204
211
  # @return [void]
205
212
  #
@@ -242,6 +249,41 @@ module Pod
242
249
  UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)
243
250
  end
244
251
 
252
+ # Adds the ODRs that are related to this app spec. This includes the app spec dependencies as well as the ODRs
253
+ # coming from the app spec itself.
254
+ #
255
+ # @param [Xcodeproj::PBXNativeTarget] native_target
256
+ # the native target for which to add the ODR file references into.
257
+ #
258
+ # @param [Specification] app_spec
259
+ # the app spec to integrate ODRs for.
260
+ #
261
+ # @return [void]
262
+ #
263
+ def add_on_demand_resources(native_target, app_spec)
264
+ dependent_targets = target.dependent_targets_for_app_spec(app_spec)
265
+ parent_odr_group = native_target.project.group_for_spec(app_spec.name)
266
+
267
+ # Add ODRs of the app spec dependencies first.
268
+ dependent_targets.each do |pod_target|
269
+ file_accessors = pod_target.file_accessors.select do |fa|
270
+ fa.spec.library_specification? ||
271
+ fa.spec.test_specification? && pod_target.test_app_hosts_by_spec[fa.spec]&.first == app_spec
272
+ end
273
+ target_odr_group_name = "#{pod_target.label}-OnDemandResources"
274
+ UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,
275
+ native_target, file_accessors,
276
+ parent_odr_group, target_odr_group_name)
277
+ end
278
+
279
+ # Now add the ODRs of our own app spec declaration.
280
+ file_accessor = target.file_accessors.find { |fa| fa.spec == app_spec }
281
+ target_odr_group_name = "#{target.subspec_label(app_spec)}-OnDemandResources"
282
+ UserProjectIntegrator::TargetIntegrator.update_on_demand_resources(target.sandbox, native_target.project,
283
+ native_target, file_accessor,
284
+ parent_odr_group, target_odr_group_name)
285
+ end
286
+
245
287
  # @return [String] the message that should be displayed for the target
246
288
  # integration.
247
289
  #
@@ -38,7 +38,7 @@ module Pod
38
38
  #
39
39
  attr_reader :podfile_path
40
40
 
41
- # @return [Bool] Bool indicating if this project is a pod target subproject.
41
+ # @return [Boolean] Bool indicating if this project is a pod target subproject.
42
42
  # Used by `generate_multiple_pod_projects` installation option.
43
43
  #
44
44
  attr_reader :pod_target_subproject
@@ -103,11 +103,13 @@ module Pod
103
103
  ios_deployment_target = platforms.select { |p| p.name == :ios }.map(&:deployment_target).min
104
104
  watchos_deployment_target = platforms.select { |p| p.name == :watchos }.map(&:deployment_target).min
105
105
  tvos_deployment_target = platforms.select { |p| p.name == :tvos }.map(&:deployment_target).min
106
+ visionos_deployment_target = platforms.select { |p| p.name == :visionos }.map(&:deployment_target).min
106
107
  project.build_configurations.each do |build_configuration|
107
108
  build_configuration.build_settings['MACOSX_DEPLOYMENT_TARGET'] = osx_deployment_target.to_s if osx_deployment_target
108
109
  build_configuration.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = ios_deployment_target.to_s if ios_deployment_target
109
110
  build_configuration.build_settings['WATCHOS_DEPLOYMENT_TARGET'] = watchos_deployment_target.to_s if watchos_deployment_target
110
111
  build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
112
+ build_configuration.build_settings['XROS_DEPLOYMENT_TARGET'] = visionos_deployment_target.to_s if visionos_deployment_target
111
113
  build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
112
114
  build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
113
115
  build_configuration.build_settings['CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED'] = 'YES'
@@ -79,12 +79,12 @@ module Pod
79
79
  # @param [Specification] spec
80
80
  # The specification to base from in order to find the native target.
81
81
  #
82
- # @return [PBXNativeTarget] the native target to use or `nil` if none is found.
82
+ # @return [PBXNativeTarget, Nil] the native target to use or `nil` if none is found.
83
83
  #
84
84
  def native_target_for_spec(spec)
85
85
  return native_target if spec.library_specification?
86
86
  return test_native_target_from_spec(spec) if spec.test_specification?
87
- return app_native_target_from_spec(spec) if spec.app_specification?
87
+ app_native_target_from_spec(spec) if spec.app_specification?
88
88
  end
89
89
 
90
90
  # @return [Hash{PBXNativeTarget => Specification}] a hash where the keys are the test native targets and the value
@@ -56,11 +56,8 @@ module Pod
56
56
  name = target.label
57
57
  platform = target.platform.name
58
58
  language = target.uses_swift? ? :swift : :objc
59
- native_target = project.new_target(product_type, name, platform, deployment_target, nil, language)
60
-
61
- product_name = target.product_name
62
- product = native_target.product_reference
63
- product.name = product_name
59
+ native_target = project.new_target(product_type, name, platform, deployment_target, nil, language, target.product_basename)
60
+ native_target.product_reference.name = name
64
61
 
65
62
  target.user_build_configurations.each do |bc_name, type|
66
63
  native_target.add_build_configuration(bc_name, type)
@@ -97,6 +94,12 @@ module Pod
97
94
  settings.merge!('OTHER_LDFLAGS' => '', 'OTHER_LIBTOOLFLAGS' => '')
98
95
  end
99
96
 
97
+ # This interferes with our custom run script phases
98
+ settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'NO'
99
+
100
+ # We aren't yet ready to support this for our targets
101
+ settings['ENABLE_MODULE_VERIFIER'] = 'NO'
102
+
100
103
  settings
101
104
  end
102
105
 
@@ -48,17 +48,23 @@ module Pod
48
48
  # @param [Hash] additional_entries
49
49
  # any additional entries to include in this Info.plist file.
50
50
  #
51
+ # @param [String] build_setting_value
52
+ # an optional value to set for the `INFOPLIST_FILE` build setting on the
53
+ # native target. If none is specified then the value is calculated from the
54
+ # Info.plist path relative to the sandbox root.
55
+ #
51
56
  # @return [void]
52
57
  #
53
58
  def create_info_plist_file_with_sandbox(sandbox, path, native_target, version, platform,
54
- bundle_package_type = :fmwk, additional_entries: {})
59
+ bundle_package_type = :fmwk, additional_entries: {},
60
+ build_setting_value: nil)
55
61
  UI.message "- Generating Info.plist file at #{UI.path(path)}" do
56
62
  generator = Generator::InfoPlistFile.new(version, platform, bundle_package_type, additional_entries)
57
63
  update_changed_file(generator, path)
58
64
 
59
- relative_path_string = path.relative_path_from(sandbox.root).to_s
65
+ build_setting_value ||= path.relative_path_from(sandbox.root).to_s
60
66
  native_target.build_configurations.each do |c|
61
- c.build_settings['INFOPLIST_FILE'] = relative_path_string
67
+ c.build_settings['INFOPLIST_FILE'] = build_setting_value
62
68
  end
63
69
  end
64
70
  end
@@ -195,7 +195,7 @@ module Pod
195
195
 
196
196
  # @param [String] pod The root name of the development pod.
197
197
  #
198
- # @return [Bool] whether the scheme for the given development pod should be
198
+ # @return [Boolean] whether the scheme for the given development pod should be
199
199
  # shared.
200
200
  #
201
201
  def share_scheme_for_development_pod?(pod)
@@ -247,7 +247,7 @@ module Pod
247
247
  end
248
248
  is_custom_host = !hosted_test_specs_by_host.empty?
249
249
  specs.each do |spec|
250
- scheme_name = spec.spec_type == :library ? pod_target.label : pod_target.non_library_spec_label(spec)
250
+ scheme_name = pod_target.spec_label(spec)
251
251
  scheme_configuration = pod_target.scheme_for_spec(spec)
252
252
  if !scheme_configuration.empty? || is_custom_host
253
253
  scheme_path = Xcodeproj::XCScheme.user_data_dir(project.path) + "#{scheme_name}.xcscheme"
@@ -265,6 +265,10 @@ module Pod
265
265
  if scheme_configuration.key?(:code_coverage)
266
266
  scheme.test_action.code_coverage_enabled = scheme_configuration[:code_coverage]
267
267
  end
268
+ if scheme_configuration.key?(:parallelizable)
269
+ scheme.test_action.testables.each { |testable| testable.parallelizable = scheme_configuration[:parallelizable] }
270
+ end
271
+ set_scheme_build_configurations(scheme, scheme_configuration.fetch(:build_configurations, {}))
268
272
 
269
273
  hosted_test_specs_by_host[spec].each do |hosted_spec|
270
274
  # We are an app spec which hosts this test spec.
@@ -285,6 +289,37 @@ module Pod
285
289
  Xcodeproj::XCScheme.share_scheme(project.path, scheme_name) if share_scheme
286
290
  end
287
291
  end
292
+
293
+ # @param [Xcodeproj::XCSheme] scheme
294
+ # scheme to apply configuration to
295
+ #
296
+ # @param [Hash{String => String}] configuration
297
+ # action => build configuration to use for the action
298
+ #
299
+ # @return [void]
300
+ #
301
+ def set_scheme_build_configurations(scheme, configuration)
302
+ configuration.each do |k, v|
303
+ unless @build_configurations.include?(v)
304
+ raise Informative, "Unable to set `#{v}` as a build configuration as " \
305
+ "it doesn't match with any of your projects build configurations."
306
+ end
307
+
308
+ case k
309
+ when 'Run'
310
+ scheme.launch_action.build_configuration = v
311
+ when 'Test'
312
+ scheme.test_action.build_configuration = v
313
+ when 'Analyze'
314
+ scheme.analyze_action.build_configuration = v
315
+ when 'Archive'
316
+ scheme.archive_action.build_configuration = v
317
+ else
318
+ raise Informative, "#{k} is not a valid scheme action " \
319
+ "only one of ['run', 'test', 'analyze', 'archive'] is available"
320
+ end
321
+ end
322
+ end
288
323
  end
289
324
  end
290
325
  end
@@ -129,7 +129,7 @@ module Pod
129
129
  def verify_swift_pods_have_module_dependencies
130
130
  error_messages = []
131
131
  pod_targets.each do |pod_target|
132
- next unless pod_target.uses_swift?
132
+ next unless pod_target.uses_swift? && pod_target.should_build?
133
133
 
134
134
  non_module_dependencies = []
135
135
  pod_target.dependent_targets.each do |dependent_target|