cocoapods 1.10.0 → 1.11.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +237 -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.rb +18 -9
  7. data/lib/cocoapods/command/spec/cat.rb +3 -1
  8. data/lib/cocoapods/command/spec/lint.rb +1 -1
  9. data/lib/cocoapods/command/spec/which.rb +3 -1
  10. data/lib/cocoapods/config.rb +1 -1
  11. data/lib/cocoapods/downloader.rb +4 -2
  12. data/lib/cocoapods/downloader/cache.rb +95 -6
  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 +2 -18
  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.rb +52 -4
  22. data/lib/cocoapods/installer/analyzer.rb +12 -8
  23. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +31 -4
  24. data/lib/cocoapods/installer/podfile_validator.rb +2 -2
  25. data/lib/cocoapods/installer/pre_integrate_hooks_context.rb +9 -0
  26. data/lib/cocoapods/installer/project_cache/project_cache_analyzer.rb +9 -2
  27. data/lib/cocoapods/installer/project_cache/project_installation_cache.rb +15 -2
  28. data/lib/cocoapods/installer/project_cache/target_cache_key.rb +7 -4
  29. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +149 -9
  30. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +1 -1
  31. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +10 -3
  32. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +25 -6
  33. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +6 -19
  34. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +70 -58
  35. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +48 -6
  36. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +2 -2
  37. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +2 -5
  38. data/lib/cocoapods/resolver.rb +4 -4
  39. data/lib/cocoapods/sandbox/file_accessor.rb +57 -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.rb +1 -1
  45. data/lib/cocoapods/target/aggregate_target.rb +23 -1
  46. data/lib/cocoapods/target/build_settings.rb +45 -20
  47. data/lib/cocoapods/target/pod_target.rb +47 -22
  48. data/lib/cocoapods/user_interface.rb +4 -0
  49. data/lib/cocoapods/validator.rb +25 -5
  50. data/lib/cocoapods/version_metadata.rb +1 -1
  51. data/lib/cocoapods/xcode/xcframework.rb +8 -3
  52. data/lib/cocoapods/xcode/xcframework/xcframework_slice.rb +10 -1
  53. metadata +28 -21
@@ -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"
@@ -45,6 +45,11 @@ module Pod
45
45
  #
46
46
  attr_reader :info_plist_entries
47
47
 
48
+ # @return [String] product_basename
49
+ # The product basename to use for the target.
50
+ #
51
+ attr_reader :product_basename
52
+
48
53
  # Initialize a new instance
49
54
  #
50
55
  # @param [Sandbox] sandbox @see #sandbox
@@ -55,8 +60,9 @@ module Pod
55
60
  # @param [String] app_target_label see #app_target_label
56
61
  # @param [Boolean] add_main see #add_main
57
62
  # @param [Hash] info_plist_entries see #info_plist_entries
63
+ # @param [String] product_basename see #product_basename
58
64
  #
59
- def initialize(sandbox, project, platform, subgroup_name, group_name, app_target_label, add_main: true, add_launchscreen_storyboard: platform == :ios, info_plist_entries: {})
65
+ def initialize(sandbox, project, platform, subgroup_name, group_name, app_target_label, add_main: true, add_launchscreen_storyboard: platform == :ios, info_plist_entries: {}, product_basename: nil)
60
66
  @sandbox = sandbox
61
67
  @project = project
62
68
  @platform = platform
@@ -66,6 +72,7 @@ module Pod
66
72
  @add_main = add_main
67
73
  @add_launchscreen_storyboard = add_launchscreen_storyboard
68
74
  @info_plist_entries = info_plist_entries
75
+ @product_basename = product_basename || app_target_label
69
76
  target_group = project.pod_group(group_name)
70
77
  @group = target_group[subgroup_name] || target_group.new_group(subgroup_name)
71
78
  end
@@ -75,9 +82,9 @@ module Pod
75
82
  def install!
76
83
  platform_name = platform.name
77
84
  app_host_target = Pod::Generator::AppTargetHelper.add_app_target(project, platform_name, deployment_target,
78
- app_target_label)
85
+ app_target_label, product_basename)
79
86
  app_host_target.build_configurations.each do |configuration|
80
- configuration.build_settings['PRODUCT_NAME'] = app_target_label
87
+ configuration.build_settings['PRODUCT_NAME'] = product_basename
81
88
  configuration.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}'
82
89
  if platform == :osx
83
90
  configuration.build_settings['CODE_SIGN_IDENTITY'] = ''
@@ -6,6 +6,9 @@ module Pod
6
6
  # specifications in the Pods project.
7
7
  #
8
8
  class FileReferencesInstaller
9
+ # Regex for extracting the region portion of a localized file path. Ex. `Resources/en.lproj` --> `en`
10
+ LOCALIZATION_REGION_FILEPATTERN_REGEX = /(\/|^)(?<region>[^\/]*?)\.lproj(\/|$)/
11
+
9
12
  # @return [Sandbox] The sandbox of the installation.
10
13
  #
11
14
  attr_reader :sandbox
@@ -126,8 +129,9 @@ module Pod
126
129
  #
127
130
  def add_resources
128
131
  UI.message '- Adding resources' do
129
- add_file_accessors_paths_to_pods_group(:resources, :resources, true)
130
- add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources, true)
132
+ refs = add_file_accessors_paths_to_pods_group(:resources, :resources, true)
133
+ refs.concat add_file_accessors_paths_to_pods_group(:resource_bundle_files, :resources, true)
134
+ add_known_regions(refs)
131
135
  end
132
136
  end
133
137
 
@@ -207,20 +211,20 @@ module Pod
207
211
  # Whether organizing a local pod's files in subgroups inside
208
212
  # the pod's group is allowed.
209
213
  #
210
- # @return [void]
214
+ # @return [Array<PBXFileReference>] the added file references
211
215
  #
212
216
  def add_file_accessors_paths_to_pods_group(file_accessor_key, group_key = nil, reflect_file_system_structure = false)
213
- file_accessors.each do |file_accessor|
217
+ file_accessors.flat_map do |file_accessor|
214
218
  paths = file_accessor.send(file_accessor_key)
215
219
  paths = allowable_project_paths(paths)
216
- next if paths.empty?
220
+ next [] if paths.empty?
217
221
 
218
222
  pod_name = file_accessor.spec.name
219
223
  preserve_pod_file_structure_flag = (sandbox.local?(pod_name) || preserve_pod_file_structure) && reflect_file_system_structure
220
224
  base_path = preserve_pod_file_structure_flag ? common_path(paths) : nil
221
225
  actual_group_key = preserve_pod_file_structure_flag ? nil : group_key
222
226
  group = pods_project.group_for_spec(pod_name, actual_group_key)
223
- paths.each do |path|
227
+ paths.map do |path|
224
228
  pods_project.add_file_reference(path, group, preserve_pod_file_structure_flag, base_path)
225
229
  end
226
230
  end
@@ -302,6 +306,21 @@ module Pod
302
306
  return result unless result.to_s == '' || result.to_s == '/'
303
307
  end
304
308
 
309
+ # Adds the known localization regions to the root of the project
310
+ #
311
+ # @param [Array<PBXFileReferences>] file_references the resource file references
312
+ #
313
+ def add_known_regions(file_references)
314
+ pattern = LOCALIZATION_REGION_FILEPATTERN_REGEX
315
+ regions = file_references.map do |ref|
316
+ if (match = ref.path.to_s.match(pattern))
317
+ match[:region]
318
+ end
319
+ end.compact
320
+
321
+ pods_project.root_object.known_regions = (pods_project.root_object.known_regions | regions).sort
322
+ end
323
+
305
324
  #-----------------------------------------------------------------------#
306
325
  end
307
326
  end
@@ -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,20 +850,8 @@ 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
- # of the OS X into the framework bundle's root root directory.
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
855
856
  # via custom copy file build phases in combination with
856
857
  # header_mappings_dir interferes with xcodebuild's expectations
@@ -862,11 +863,16 @@ module Pod
862
863
  # @return [void]
863
864
  #
864
865
  def create_build_phase_to_symlink_header_folders(native_target)
865
- return unless target.platform.name == :osx && any_header_mapping_dirs?
866
+ # This is required on iOS for Catalyst, which uses macOS framework layouts
867
+ return unless (target.platform.name == :osx || target.platform.name == :ios) && any_header_mapping_dirs?
866
868
 
867
869
  build_phase = native_target.new_shell_script_build_phase('Create Symlinks to Header Folders')
868
870
  build_phase.shell_script = <<-eos.strip_heredoc
869
871
  cd "$CONFIGURATION_BUILD_DIR/$WRAPPER_NAME" || exit 1
872
+ if [ ! -d Versions ]; then
873
+ # Not a versioned framework, so no need to do anything
874
+ exit 0
875
+ fi
870
876
 
871
877
  public_path="${PUBLIC_HEADERS_FOLDER_PATH\#\$CONTENTS_FOLDER_PATH/}"
872
878
  if [ ! -f "$public_path" ]; then
@@ -993,7 +999,7 @@ module Pod
993
999
  end
994
1000
 
995
1001
  def create_umbrella_header(native_target)
996
- return super(native_target) unless custom_module_map
1002
+ super(native_target) unless custom_module_map
997
1003
  end
998
1004
 
999
1005
  def custom_module_map
@@ -1030,12 +1036,14 @@ module Pod
1030
1036
  end
1031
1037
  end
1032
1038
 
1033
- 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)
1034
1040
  file_ref = build_file.file_ref
1035
1041
  acl = if !target.build_as_framework? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
1036
1042
  'Project'
1037
1043
  elsif public_headers.include?(file_ref.real_path)
1038
1044
  'Public'
1045
+ elsif project_headers.include?(file_ref.real_path)
1046
+ 'Project'
1039
1047
  elsif private_headers.include?(file_ref.real_path)
1040
1048
  'Private'
1041
1049
  else
@@ -1191,7 +1199,11 @@ module Pod
1191
1199
  def dsym_paths(target)
1192
1200
  dsym_paths = target.framework_paths.values.flatten.reject { |fmwk_path| fmwk_path.dsym_path.nil? }.map(&:dsym_path)
1193
1201
  dsym_paths.concat(target.xcframeworks.values.flatten.flat_map { |xcframework| xcframework_dsyms(xcframework.path) })
1194
- 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
1195
1207
  end
1196
1208
 
1197
1209
  # @param [PodTarget] target the target to be installed
@@ -1201,7 +1213,7 @@ module Pod
1201
1213
  def bcsymbolmap_paths(target)
1202
1214
  target.framework_paths.values.flatten.reject do |fmwk_path|
1203
1215
  fmwk_path.bcsymbolmap_paths.nil?
1204
- end.flat_map(&:bcsymbolmap_paths)
1216
+ end.flat_map(&:bcsymbolmap_paths).uniq
1205
1217
  end
1206
1218
 
1207
1219
  # @param [Pathname] xcframework_path