cocoapods 1.10.2 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +214 -5
  3. data/README.md +11 -11
  4. data/lib/cocoapods/command/outdated.rb +12 -1
  5. data/lib/cocoapods/command/repo/push.rb +17 -0
  6. data/lib/cocoapods/command/spec/cat.rb +3 -1
  7. data/lib/cocoapods/command/spec/lint.rb +1 -1
  8. data/lib/cocoapods/command/spec/which.rb +3 -1
  9. data/lib/cocoapods/command/spec.rb +18 -9
  10. data/lib/cocoapods/config.rb +1 -1
  11. data/lib/cocoapods/downloader/cache.rb +95 -6
  12. data/lib/cocoapods/downloader.rb +4 -2
  13. data/lib/cocoapods/external_sources/podspec_source.rb +1 -1
  14. data/lib/cocoapods/gem_version.rb +1 -1
  15. data/lib/cocoapods/generator/acknowledgements.rb +1 -1
  16. data/lib/cocoapods/generator/app_target_helper.rb +7 -3
  17. data/lib/cocoapods/generator/copy_dsyms_script.rb +4 -4
  18. data/lib/cocoapods/generator/copy_xcframework_script.rb +4 -48
  19. data/lib/cocoapods/generator/embed_frameworks_script.rb +2 -1
  20. data/lib/cocoapods/generator/script_phase_constants.rb +1 -0
  21. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +31 -4
  22. data/lib/cocoapods/installer/analyzer.rb +12 -8
  23. data/lib/cocoapods/installer/podfile_validator.rb +2 -2
  24. data/lib/cocoapods/installer/pre_integrate_hooks_context.rb +9 -0
  25. data/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +9 -2
  26. data/lib/cocoapods/installer/project_cache/project_installation_cache.rb +15 -2
  27. data/lib/cocoapods/installer/project_cache/target_cache_key.rb +7 -4
  28. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +149 -9
  29. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +10 -3
  30. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +25 -6
  31. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +6 -19
  32. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +63 -56
  33. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +48 -6
  34. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +2 -2
  35. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +2 -5
  36. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +1 -1
  37. data/lib/cocoapods/installer.rb +52 -4
  38. data/lib/cocoapods/resolver.rb +4 -4
  39. data/lib/cocoapods/sandbox/file_accessor.rb +48 -10
  40. data/lib/cocoapods/sandbox/headers_store.rb +3 -1
  41. data/lib/cocoapods/sandbox/path_list.rb +1 -1
  42. data/lib/cocoapods/sandbox/pod_dir_cleaner.rb +1 -1
  43. data/lib/cocoapods/sources_manager.rb +14 -8
  44. data/lib/cocoapods/target/aggregate_target.rb +23 -1
  45. data/lib/cocoapods/target/build_settings.rb +45 -20
  46. data/lib/cocoapods/target/pod_target.rb +47 -22
  47. data/lib/cocoapods/user_interface.rb +4 -0
  48. data/lib/cocoapods/validator.rb +24 -4
  49. data/lib/cocoapods/version_metadata.rb +1 -1
  50. data/lib/cocoapods/xcode/xcframework.rb +8 -3
  51. metadata +26 -19
@@ -36,25 +36,24 @@ module Pod
36
36
  pod_target = pod_target_installation_result.target
37
37
  native_target = pod_target_installation_result.native_target
38
38
  project = native_target.project
39
- frameworks_group = project.frameworks_group
40
39
 
41
40
  # First, wire up all resource bundles.
42
41
  wire_resource_bundle_targets(pod_target_installation_result.resource_bundle_targets,
43
42
  native_target, pod_target)
44
43
  # Wire up all dependencies to this pod target, if any.
45
44
  wire_target_dependencies(pod_target, native_target, project, pod_target_installation_results,
46
- metadata_cache, frameworks_group)
45
+ metadata_cache)
47
46
 
48
47
  # Wire up test native targets.
49
48
  unless pod_target_installation_result.test_native_targets.empty?
50
49
  wire_test_native_targets(pod_target, pod_target_installation_result, pod_target_installation_results,
51
- project, frameworks_group, metadata_cache)
50
+ project, metadata_cache)
52
51
  end
53
52
 
54
53
  # Wire up app native targets.
55
54
  unless pod_target_installation_result.app_native_targets.empty?
56
55
  wire_app_native_targets(pod_target, pod_target_installation_result, pod_target_installation_results,
57
- project, frameworks_group, metadata_cache)
56
+ project, metadata_cache)
58
57
  end
59
58
  end
60
59
  end
@@ -70,8 +69,7 @@ module Pod
70
69
  end
71
70
  end
72
71
 
73
- def wire_target_dependencies(pod_target, native_target, project,
74
- pod_target_installation_results, metadata_cache, frameworks_group)
72
+ def wire_target_dependencies(pod_target, native_target, project, pod_target_installation_results, metadata_cache)
75
73
  dependent_targets = pod_target.dependent_targets
76
74
  dependent_targets.each do |dependent_target|
77
75
  is_local = sandbox.local?(dependent_target.pod_name)
@@ -81,7 +79,6 @@ module Pod
81
79
  project.add_pod_subproject(dependent_project, is_local)
82
80
  end
83
81
  native_target.add_dependency(installation_result.native_target)
84
- add_framework_file_reference_to_native_target(native_target, pod_target, dependent_target, frameworks_group)
85
82
  else
86
83
  # Hit the cache
87
84
  cached_dependency = metadata_cache.target_label_by_metadata[dependent_target.label]
@@ -91,7 +88,7 @@ module Pod
91
88
  end
92
89
  end
93
90
 
94
- def wire_test_native_targets(pod_target, installation_result, pod_target_installation_results, project, frameworks_group, metadata_cache)
91
+ def wire_test_native_targets(pod_target, installation_result, pod_target_installation_results, project, metadata_cache)
95
92
  installation_result.test_specs_by_native_target.each do |test_native_target, test_spec|
96
93
  resource_bundle_native_targets = installation_result.test_resource_bundle_targets[test_spec.name] || []
97
94
  resource_bundle_native_targets.each do |test_resource_bundle_target|
@@ -107,7 +104,6 @@ module Pod
107
104
  project.add_pod_subproject(dependent_test_project, is_local)
108
105
  end
109
106
  test_native_target.add_dependency(dependency_installation_result.native_target)
110
- add_framework_file_reference_to_native_target(test_native_target, pod_target, test_dependent_target, frameworks_group)
111
107
  else
112
108
  # Hit the cache
113
109
  cached_dependency = metadata_cache.target_label_by_metadata[test_dependent_target.label]
@@ -162,7 +158,7 @@ module Pod
162
158
  end
163
159
  end
164
160
 
165
- def wire_app_native_targets(pod_target, installation_result, pod_target_installation_results, project, frameworks_group, metadata_cache)
161
+ def wire_app_native_targets(pod_target, installation_result, pod_target_installation_results, project, metadata_cache)
166
162
  installation_result.app_specs_by_native_target.each do |app_native_target, app_spec|
167
163
  resource_bundle_native_targets = installation_result.app_resource_bundle_targets[app_spec.name] || []
168
164
  resource_bundle_native_targets.each do |app_resource_bundle_target|
@@ -184,7 +180,6 @@ module Pod
184
180
  project.add_pod_subproject(dependency_project, is_local)
185
181
  end
186
182
  app_native_target.add_dependency(dependency_installation_result.native_target)
187
- add_framework_file_reference_to_native_target(app_native_target, pod_target, app_dependent_target, frameworks_group)
188
183
  else
189
184
  # Hit the cache
190
185
  cached_dependency = metadata_cache.target_label_by_metadata[app_dependent_target.label]
@@ -194,14 +189,6 @@ module Pod
194
189
  end
195
190
  end
196
191
  end
197
-
198
- def add_framework_file_reference_to_native_target(native_target, pod_target, dependent_target, frameworks_group)
199
- if pod_target.should_build? && pod_target.build_as_dynamic? && dependent_target.should_build?
200
- product_ref = frameworks_group.files.find { |f| f.path == dependent_target.product_name } ||
201
- frameworks_group.new_product_ref_for_target(dependent_target.product_basename, dependent_target.product_type)
202
- native_target.frameworks_build_phase.add_file_reference(product_ref, true)
203
- end
204
- end
205
192
  end
206
193
  end
207
194
  end
@@ -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
@@ -264,10 +267,10 @@ module Pod
264
267
  # @yield_param [Array<PBXFileReference>} The filtered resource file references to be installed
265
268
  # in the compile sources phase.
266
269
  #
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
270
+ # @note Core Data model directories (.xcdatamodeld) and RealityKit projects (.rcproject)
271
+ # used to be added to the `Copy Resources` build phase like all other resources,
272
+ # since they would compile correctly in either the resources or compile phase. In
273
+ # recent versions of xcode, there's an exception for data models that generate
271
274
  # headers. These need to be added to the compile sources phase of a real
272
275
  # target for the headers to be built in time for code in the target to
273
276
  # use them. These kinds of models generally break when added to resource
@@ -287,7 +290,7 @@ module Pod
287
290
 
288
291
  ref
289
292
  end.compact.uniq
290
- compile_phase_matcher = lambda { |ref| !(ref.path =~ /.*\.xcdatamodeld/i).nil? }
293
+ compile_phase_matcher = lambda { |ref| !(ref.path =~ /.*\.(xcdatamodeld|rcproject)/i).nil? }
291
294
  compile_phase_refs, resources_phase_refs = file_references.partition(&compile_phase_matcher)
292
295
  yield compile_phase_refs, resources_phase_refs
293
296
  end
@@ -307,21 +310,26 @@ module Pod
307
310
  #
308
311
  # @return [void]
309
312
  #
310
- def add_files_to_build_phases(native_target, test_native_targets, app_native_targets)
313
+ def add_files_to_build_phases(library_native_target, test_native_targets, app_native_targets)
311
314
  target.file_accessors.each do |file_accessor|
312
315
  consumer = file_accessor.spec_consumer
313
316
 
314
317
  native_target = case consumer.spec.spec_type
315
318
  when :library
316
- native_target
319
+ library_native_target
317
320
  when :test
318
321
  test_native_target_from_spec(consumer.spec, test_native_targets)
319
322
  when :app
320
323
  app_native_targets[consumer.spec]
324
+ else
325
+ raise ArgumentError, "Unknown spec type #{consumer.spec.spec_type}."
321
326
  end
322
327
 
328
+ next if native_target.is_a?(Xcodeproj::Project::Object::PBXAggregateTarget)
329
+
323
330
  headers = file_accessor.headers
324
331
  public_headers = file_accessor.public_headers.map(&:realpath)
332
+ project_headers = file_accessor.project_headers.map(&:realpath)
325
333
  private_headers = file_accessor.private_headers.map(&:realpath)
326
334
  other_source_files = file_accessor.other_source_files
327
335
 
@@ -344,7 +352,7 @@ module Pod
344
352
 
345
353
  header_file_refs = project_file_references_array(headers, 'header')
346
354
  native_target.add_file_references(header_file_refs) do |build_file|
347
- add_header(file_accessor, build_file, public_headers, private_headers, native_target)
355
+ add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
348
356
  end
349
357
 
350
358
  other_file_refs = project_file_references_array(other_source_files, 'other source')
@@ -356,7 +364,10 @@ module Pod
356
364
  native_target.add_file_references(compile_phase_refs, nil)
357
365
 
358
366
  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)) }
367
+ resource_phase_refs = resource_phase_refs.select do |ref|
368
+ filename = ref.name || ref.path
369
+ Target.resource_extension_compilable?(File.extname(filename))
370
+ end
360
371
  end
361
372
 
362
373
  native_target.add_resources(resource_phase_refs)
@@ -377,9 +388,11 @@ module Pod
377
388
  name = target.test_target_label(test_spec)
378
389
  platform_name = target.platform.name
379
390
  language = target.uses_swift_for_spec?(test_spec) ? :swift : :objc
391
+ product_basename = target.product_basename_for_spec(test_spec)
392
+ embedded_content_contains_swift = target.dependent_targets_for_test_spec(test_spec).any?(&:uses_swift?)
380
393
  test_native_target = project.new_target(product_type, name, platform_name,
381
394
  target.deployment_target_for_non_library_spec(test_spec), nil,
382
- language)
395
+ language, product_basename)
383
396
  test_native_target.product_reference.name = name
384
397
 
385
398
  target.user_build_configurations.each do |bc_name, type|
@@ -413,6 +426,9 @@ module Pod
413
426
  elsif target.platform == :ios
414
427
  configuration.build_settings['CODE_SIGN_IDENTITY'] = 'iPhone Developer'
415
428
  end
429
+ # Ensure swift stdlib gets copied in if needed, even when the target contains no swift files,
430
+ # because a dependency uses swift
431
+ configuration.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES' if embedded_content_contains_swift
416
432
  end
417
433
 
418
434
  remove_pod_target_xcconfig_overrides_from_target(target.test_spec_build_settings_by_config[test_spec.name], test_native_target)
@@ -463,10 +479,12 @@ module Pod
463
479
  info_plist_entries = spec_consumer.info_plist
464
480
  resources = target.file_accessors.find { |fa| fa.spec == app_spec }.resources
465
481
  add_launchscreen_storyboard = resources.none? { |resource| resource.basename.to_s == 'LaunchScreen.storyboard' } && platform.name == :ios
482
+ embedded_content_contains_swift = target.dependent_targets_for_app_spec(app_spec).any?(&:uses_swift?)
466
483
  app_native_target = AppHostInstaller.new(sandbox, project, platform, subspec_name, spec_name,
467
484
  app_target_label, :add_main => false,
468
485
  :add_launchscreen_storyboard => add_launchscreen_storyboard,
469
- :info_plist_entries => info_plist_entries).install!
486
+ :info_plist_entries => info_plist_entries,
487
+ :product_basename => target.product_basename_for_spec(app_spec)).install!
470
488
 
471
489
  app_native_target.product_reference.name = app_target_label
472
490
  target.user_build_configurations.each do |bc_name, type|
@@ -505,6 +523,9 @@ module Pod
505
523
  configuration.build_settings.delete('CODE_SIGN_IDENTITY[sdk=iphoneos*]')
506
524
  configuration.build_settings.delete('CODE_SIGN_IDENTITY[sdk=watchos*]')
507
525
  end
526
+ # Ensure swift stdlib gets copied in if needed, even when the target contains no swift files,
527
+ # because a dependency uses swift
528
+ configuration.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'YES' if embedded_content_contains_swift
508
529
  end
509
530
 
510
531
  remove_pod_target_xcconfig_overrides_from_target(target.app_spec_build_settings_by_config[app_spec.name], app_native_target)
@@ -548,12 +569,8 @@ module Pod
548
569
  file_accessors.each_with_object({}) do |file_accessor, hash|
549
570
  hash[file_accessor.spec.name] = file_accessor.resource_bundles.map do |bundle_name, paths|
550
571
  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
-
572
+ resource_bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name, nil, bundle_name)
573
+ resource_bundle_target.product_reference.name = label
557
574
  contains_compile_phase_refs = add_resources_to_target(paths, resource_bundle_target)
558
575
 
559
576
  target.user_build_configurations.each do |bc_name, type|
@@ -655,10 +672,6 @@ module Pod
655
672
  scoped_test_resource_bundle_targets = test_resource_bundle_targets[test_spec.name]
656
673
  apply_xcconfig_file_ref_to_targets([test_native_target] + scoped_test_resource_bundle_targets, test_xcconfig_file_ref, names)
657
674
  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
675
  end
663
676
  end
664
677
 
@@ -837,18 +850,6 @@ module Pod
837
850
  add_file_to_support_group(path)
838
851
  end
839
852
 
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
853
  # Creates a build phase which links the versioned header folders
853
854
  # of the OS X framework into the framework bundle's root directory.
854
855
  # This is only necessary because the way how headers are copied
@@ -998,7 +999,7 @@ module Pod
998
999
  end
999
1000
 
1000
1001
  def create_umbrella_header(native_target)
1001
- return super(native_target) unless custom_module_map
1002
+ super(native_target) unless custom_module_map
1002
1003
  end
1003
1004
 
1004
1005
  def custom_module_map
@@ -1035,12 +1036,14 @@ module Pod
1035
1036
  end
1036
1037
  end
1037
1038
 
1038
- def add_header(file_accessor, build_file, public_headers, private_headers, native_target)
1039
+ def add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
1039
1040
  file_ref = build_file.file_ref
1040
1041
  acl = if !target.build_as_framework? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
1041
1042
  'Project'
1042
1043
  elsif public_headers.include?(file_ref.real_path)
1043
1044
  'Public'
1045
+ elsif project_headers.include?(file_ref.real_path)
1046
+ 'Project'
1044
1047
  elsif private_headers.include?(file_ref.real_path)
1045
1048
  'Private'
1046
1049
  else
@@ -1196,7 +1199,11 @@ module Pod
1196
1199
  def dsym_paths(target)
1197
1200
  dsym_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.dsym_path.nil? }.map(&:dsym_path)
1198
1201
  dsym_paths.concat(target.xcframeworks.values.flatten.flat_map { |xcframework| xcframework_dsyms(xcframework.path) })
1199
- dsym_paths
1202
+ dsym_paths.map do |dsym_path|
1203
+ dsym_pathname = Pathname(dsym_path)
1204
+ dsym_path = "${PODS_ROOT}/#{dsym_pathname.relative_path_from(target.sandbox.root)}" unless dsym_pathname.relative?
1205
+ dsym_path
1206
+ end
1200
1207
  end
1201
1208
 
1202
1209
  # @param [PodTarget] target the target to be installed
@@ -1206,7 +1213,7 @@ module Pod
1206
1213
  def bcsymbolmap_paths(target)
1207
1214
  target.framework_paths.values.flatten.reject do |fmwk_path|
1208
1215
  fmwk_path.bcsymbolmap_paths.nil?
1209
- end.flat_map(&:bcsymbolmap_paths)
1216
+ end.flat_map(&:bcsymbolmap_paths).uniq
1210
1217
  end
1211
1218
 
1212
1219
  # @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
  #