cocoapods 1.9.3 → 1.10.0.beta.1

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 +167 -5
  3. data/README.md +2 -1
  4. data/lib/cocoapods.rb +3 -1
  5. data/lib/cocoapods/command.rb +12 -2
  6. data/lib/cocoapods/command/lib/lint.rb +12 -3
  7. data/lib/cocoapods/command/repo/push.rb +1 -1
  8. data/lib/cocoapods/command/repo/update.rb +11 -0
  9. data/lib/cocoapods/command/spec/lint.rb +12 -3
  10. data/lib/cocoapods/config.rb +17 -0
  11. data/lib/cocoapods/downloader/cache.rb +2 -2
  12. data/lib/cocoapods/gem_version.rb +1 -1
  13. data/lib/cocoapods/generator/app_target_helper.rb +10 -2
  14. data/lib/cocoapods/generator/copy_dsyms_script.rb +56 -0
  15. data/lib/cocoapods/generator/copy_resources_script.rb +2 -14
  16. data/lib/cocoapods/generator/copy_xcframework_script.rb +245 -0
  17. data/lib/cocoapods/generator/embed_frameworks_script.rb +125 -212
  18. data/lib/cocoapods/generator/script_phase_constants.rb +99 -0
  19. data/lib/cocoapods/installer.rb +70 -3
  20. data/lib/cocoapods/installer/analyzer.rb +17 -8
  21. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +1 -1
  22. data/lib/cocoapods/installer/base_install_hooks_context.rb +135 -0
  23. data/lib/cocoapods/installer/installation_options.rb +5 -0
  24. data/lib/cocoapods/installer/pod_source_installer.rb +2 -1
  25. data/lib/cocoapods/installer/post_install_hooks_context.rb +1 -127
  26. data/lib/cocoapods/installer/post_integrate_hooks_context.rb +9 -0
  27. data/lib/cocoapods/installer/sandbox_dir_cleaner.rb +2 -1
  28. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +132 -111
  29. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +45 -6
  30. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +13 -27
  31. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +2 -1
  32. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_dependency_installer.rb +4 -4
  33. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +175 -58
  34. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +61 -30
  35. data/lib/cocoapods/installer/xcode/pods_project_generator/project_generator.rb +3 -2
  36. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +5 -7
  37. data/lib/cocoapods/installer/xcode/pods_project_generator_result.rb +19 -0
  38. data/lib/cocoapods/installer/xcode/target_validator.rb +1 -1
  39. data/lib/cocoapods/sources_manager.rb +2 -1
  40. data/lib/cocoapods/target.rb +44 -2
  41. data/lib/cocoapods/target/aggregate_target.rb +35 -0
  42. data/lib/cocoapods/target/build_settings.rb +84 -17
  43. data/lib/cocoapods/target/pod_target.rb +85 -11
  44. data/lib/cocoapods/user_interface/error_report.rb +1 -1
  45. data/lib/cocoapods/user_interface/inspector_reporter.rb +3 -10
  46. data/lib/cocoapods/validator.rb +32 -8
  47. data/lib/cocoapods/xcode/framework_paths.rb +1 -1
  48. data/lib/cocoapods/xcode/xcframework.rb +17 -4
  49. data/lib/cocoapods/xcode/xcframework/xcframework_slice.rb +81 -3
  50. metadata +30 -38
  51. data/lib/cocoapods/generator/prepare_artifacts_script.rb +0 -257
@@ -32,11 +32,12 @@ module Pod
32
32
  def integrate!
33
33
  UI.section(integration_message) do
34
34
  target_installation_result.non_library_specs_by_native_target.each do |native_target, spec|
35
- add_prepare_artifacts_script_phase(native_target, spec)
36
35
  add_embed_frameworks_script_phase(native_target, spec)
37
36
  add_copy_resources_script_phase(native_target, spec)
38
37
  UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(spec), native_target)
39
38
  end
39
+ add_copy_dsyms_script_phase(target_installation_result.native_target)
40
+ add_copy_xcframeworks_script_phase(target_installation_result.native_target)
40
41
  UserProjectIntegrator::TargetIntegrator.create_or_update_user_script_phases(script_phases_for_specs(target.library_specs), target_installation_result.native_target)
41
42
  end
42
43
  end
@@ -138,15 +139,12 @@ module Pod
138
139
  input_file_list_path = target.embed_frameworks_script_input_files_path_for_spec(spec)
139
140
  input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
140
141
  input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
141
- input_paths = input_paths_by_config[input_paths_key] = [script_path]
142
- framework_paths.each do |path|
143
- input_paths.concat(path.all_paths)
144
- end
142
+ input_paths_by_config[input_paths_key] = [script_path] + UserProjectIntegrator::TargetIntegrator.embed_frameworks_input_paths(framework_paths, [])
145
143
 
146
144
  output_file_list_path = target.embed_frameworks_script_output_files_path_for_spec(spec)
147
145
  output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
148
146
  output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
149
- output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.framework_output_paths(framework_paths)
147
+ output_paths_by_config[output_paths_key] = UserProjectIntegrator::TargetIntegrator.embed_frameworks_output_paths(framework_paths, [])
150
148
  end
151
149
 
152
150
  if framework_paths.empty?
@@ -162,34 +160,18 @@ module Pod
162
160
  # @param [PBXNativeTarget] native_target
163
161
  # the native target for which to add the prepare artifacts script
164
162
  #
165
- # @param [Pod::Specification] spec
166
- # the specification to integrate
167
- #
168
163
  # @return [void]
169
164
  #
170
- def add_prepare_artifacts_script_phase(native_target, spec)
171
- script_path = "${PODS_ROOT}/#{target.prepare_artifacts_script_path_for_spec(spec).relative_path_from(target.sandbox.root)}"
165
+ def add_copy_xcframeworks_script_phase(native_target)
166
+ script_path = "${PODS_ROOT}/#{target.copy_xcframeworks_script_path.relative_path_from(target.sandbox.root)}"
172
167
 
173
168
  input_paths_by_config = {}
174
169
  output_paths_by_config = {}
175
170
 
176
- dependent_targets = if spec.test_specification?
177
- target.dependent_targets_for_test_spec(spec)
178
- else
179
- target.dependent_targets_for_app_spec(spec)
180
- end
181
- host_target_spec_names = target.app_host_dependent_targets_for_spec(spec).flat_map do |pt|
182
- pt.specs.map(&:name)
183
- end.uniq
184
- xcframeworks = dependent_targets.flat_map do |dependent_target|
185
- spec_paths_to_include = dependent_target.library_specs.map(&:name)
186
- spec_paths_to_include -= host_target_spec_names
187
- spec_paths_to_include << spec.name if dependent_target == target
188
- dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact
189
- end.uniq
171
+ xcframeworks = target.xcframeworks.values.flatten
190
172
 
191
173
  if use_input_output_paths? && !xcframeworks.empty?
192
- input_file_list_path = target.prepare_artifacts_script_input_files_path_for_spec(spec)
174
+ input_file_list_path = target.copy_xcframeworks_script_input_files_path
193
175
  input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
194
176
  input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
195
177
  input_paths = input_paths_by_config[input_paths_key] = [script_path]
@@ -197,20 +179,69 @@ module Pod
197
179
  framework_paths = xcframeworks.map { |xcf| "${PODS_ROOT}/#{xcf.path.relative_path_from(target.sandbox.root)}" }
198
180
  input_paths.concat framework_paths
199
181
 
200
- output_file_list_path = target.prepare_artifacts_script_output_files_path_for_spec(spec)
182
+ output_file_list_path = target.copy_xcframeworks_script_output_files_path
201
183
  output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
202
184
  output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
203
- output_paths_by_config[output_paths_key] = [UserProjectIntegrator::TargetIntegrator::ARTIFACT_LIST_FILE]
185
+ output_paths_by_config[output_paths_key] = xcframeworks.map do |xcf|
186
+ "#{Target::BuildSettings::XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcf.name}"
187
+ end
204
188
  end
205
189
 
206
190
  if xcframeworks.empty?
207
- UserProjectIntegrator::TargetIntegrator.remove_prepare_artifacts_script_phase_from_target(native_target)
191
+ UserProjectIntegrator::TargetIntegrator.remove_copy_xcframeworks_script_phase_from_target(native_target)
208
192
  else
209
- UserProjectIntegrator::TargetIntegrator.create_or_update_prepare_artifacts_script_phase_to_target(
193
+ UserProjectIntegrator::TargetIntegrator.create_or_update_copy_xcframeworks_script_phase_to_target(
210
194
  native_target, script_path, input_paths_by_config, output_paths_by_config)
211
195
  end
212
196
  end
213
197
 
198
+ # Adds a script phase that copies and strips dSYMs that are part of this target. Note this only deals with
199
+ # vendored dSYMs.
200
+ #
201
+ # @param [PBXNativeTarget] native_target
202
+ # the native target for which to add the the copy dSYM files build phase.
203
+ #
204
+ # @return [void]
205
+ #
206
+ def add_copy_dsyms_script_phase(native_target)
207
+ script_path = "${PODS_ROOT}/#{target.copy_dsyms_script_path.relative_path_from(target.sandbox.root)}"
208
+ dsym_paths = PodTargetInstaller.dsym_paths(target)
209
+ bcsymbolmap_paths = PodTargetInstaller.bcsymbolmap_paths(target)
210
+
211
+ if dsym_paths.empty? && bcsymbolmap_paths.empty?
212
+ script_phase = native_target.shell_script_build_phases.find do |bp|
213
+ bp.name && bp.name.end_with?(UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME)
214
+ end
215
+ native_target.build_phases.delete(script_phase) if script_phase.present?
216
+ return
217
+ end
218
+
219
+ phase_name = UserProjectIntegrator::TargetIntegrator::BUILD_PHASE_PREFIX + UserProjectIntegrator::TargetIntegrator::COPY_DSYM_FILES_PHASE_NAME
220
+ phase = UserProjectIntegrator::TargetIntegrator.create_or_update_shell_script_build_phase(native_target, phase_name)
221
+ phase.shell_script = %("#{script_path}"\n)
222
+
223
+ input_paths_by_config = {}
224
+ output_paths_by_config = {}
225
+ if use_input_output_paths?
226
+ input_file_list_path = target.copy_dsyms_script_input_files_path
227
+ input_file_list_relative_path = "${PODS_ROOT}/#{input_file_list_path.relative_path_from(target.sandbox.root)}"
228
+ input_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(input_file_list_path, input_file_list_relative_path)
229
+ input_paths = input_paths_by_config[input_paths_key] = []
230
+ input_paths.concat([dsym_paths, *bcsymbolmap_paths].flatten.compact)
231
+
232
+ output_file_list_path = target.copy_dsyms_script_output_files_path
233
+ output_file_list_relative_path = "${PODS_ROOT}/#{output_file_list_path.relative_path_from(target.sandbox.root)}"
234
+ output_paths_key = UserProjectIntegrator::TargetIntegrator::XCFileListConfigKey.new(output_file_list_path, output_file_list_relative_path)
235
+ output_paths = output_paths_by_config[output_paths_key] = []
236
+
237
+ dsym_output_paths = dsym_paths.map { |dsym_path| "${DWARF_DSYM_FOLDER_PATH}/#{File.basename(dsym_path)}" }
238
+ bcsymbolmap_output_paths = bcsymbolmap_paths.map { |bcsymbolmap_path| "${DWARF_DSYM_FOLDER_PATH}/#{File.basename(bcsymbolmap_path)}" }
239
+ output_paths.concat([dsym_output_paths, *bcsymbolmap_output_paths].flatten.compact)
240
+ end
241
+
242
+ UserProjectIntegrator::TargetIntegrator.set_input_output_paths(phase, input_paths_by_config, output_paths_by_config)
243
+ end
244
+
214
245
  # @return [String] the message that should be displayed for the target
215
246
  # integration.
216
247
  #
@@ -30,7 +30,7 @@ module Pod
30
30
  #
31
31
  attr_reader :platforms
32
32
 
33
- # @return [String] Object version for the Xcode project.
33
+ # @return [Integer] Object version for the Xcode project.
34
34
  #
35
35
  attr_reader :object_version
36
36
 
@@ -50,7 +50,7 @@ module Pod
50
50
  # @param [Array<PodTarget>] pod_targets @see #pod_targets
51
51
  # @param [Hash{String=>Symbol}] build_configurations @see #build_configurations
52
52
  # @param [Array<Platform>] platforms @see #platforms
53
- # @param [String] object_version @see #object_version
53
+ # @param [Integer] object_version @see #object_version
54
54
  # @param [String] podfile_path @see #podfile_path
55
55
  #
56
56
  def initialize(sandbox, path, pod_targets, build_configurations, platforms,
@@ -110,6 +110,7 @@ module Pod
110
110
  build_configuration.build_settings['TVOS_DEPLOYMENT_TARGET'] = tvos_deployment_target.to_s if tvos_deployment_target
111
111
  build_configuration.build_settings['STRIP_INSTALLED_PRODUCT'] = 'NO'
112
112
  build_configuration.build_settings['CLANG_ENABLE_OBJC_ARC'] = 'YES'
113
+ build_configuration.build_settings['CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED'] = 'YES'
113
114
  end
114
115
  end
115
116
  end
@@ -38,7 +38,7 @@ module Pod
38
38
  #
39
39
  attr_reader :test_app_host_targets
40
40
 
41
- # @return [Array<PBXNativeTarget>] app_native_targets
41
+ # @return [Hash{Specification => PBXNativeTarget}] app_native_targets
42
42
  # The app native targets that were produced for this target. Can be empty if there were no app
43
43
  # native targets created (e.g. no app specs present).
44
44
  #
@@ -58,12 +58,12 @@ module Pod
58
58
  # @param [Array<PBXNativeTarget>] test_native_targets @see #test_native_targets
59
59
  # @param [Hash{String=>Array<PBXNativeTarget>}] test_resource_bundle_targets @see #test_resource_bundle_targets
60
60
  # @param [Array<PBXNativeTarget>] test_app_host_targets @see #test_app_host_targets
61
- # @param [Array<PBXNativeTarget>] app_native_targets @see #app_native_targets
61
+ # @param [Hash{Specification => PBXNativeTarget}] app_native_targets @see #app_native_targets
62
62
  # @param [Hash{String=>Array<PBXNativeTarget>}] app_resource_bundle_targets @see #app_resource_bundle_targets
63
63
  #
64
64
  def initialize(target, native_target, resource_bundle_targets = [], test_native_targets = [],
65
65
  test_resource_bundle_targets = {}, test_app_host_targets = [],
66
- app_native_targets = [], app_resource_bundle_targets = {})
66
+ app_native_targets = {}, app_resource_bundle_targets = {})
67
67
  @target = target
68
68
  @native_target = native_target
69
69
  @resource_bundle_targets = resource_bundle_targets
@@ -115,7 +115,7 @@ module Pod
115
115
  # @return [PBXNativeTarget] the app host target with the given target label.
116
116
  #
117
117
  def app_host_target_labelled(label)
118
- app_native_targets.find do |app_native_target|
118
+ app_native_targets.values.find do |app_native_target|
119
119
  app_native_target.name == label
120
120
  end || test_app_host_targets.find do |app_native_target|
121
121
  app_native_target.name == label
@@ -131,9 +131,7 @@ module Pod
131
131
  end
132
132
 
133
133
  def app_native_target_from_spec(spec)
134
- app_native_targets.find do |app_native_target|
135
- app_native_target.name == target.app_target_label(spec)
136
- end
134
+ app_native_targets[spec]
137
135
  end
138
136
  end
139
137
  end
@@ -28,6 +28,25 @@ module Pod
28
28
  @projects_by_pod_targets = projects_by_pod_targets
29
29
  @target_installation_results = target_installation_results
30
30
  end
31
+
32
+ # @param [Pod::Specification] spec
33
+ # A spec which was included in the generated project
34
+ #
35
+ # @return [Xcodeproj::PBXNativeTarget] the native target for the spec
36
+ #
37
+ def native_target_for_spec(spec)
38
+ installation_results_by_spec[spec.root].native_target_for_spec(spec)
39
+ end
40
+
41
+ private
42
+
43
+ def installation_results_by_spec
44
+ @target_installation_results_by_spec ||= begin
45
+ target_installation_results.pod_target_installation_results.values.each_with_object({}) do |installation_results, hash|
46
+ hash[installation_results.target.root_spec] = installation_results
47
+ end
48
+ end
49
+ end
31
50
  end
32
51
  end
33
52
  end
@@ -115,7 +115,7 @@ module Pod
115
115
  target_errors = swift_target_definitions.map(&error_message_for_target_definition).to_sentence
116
116
  "- `#{swift_pod_target.name}` is integrated by multiple targets that use a different Swift version: #{target_errors}."
117
117
  end
118
- elsif swift_pod_target.swift_version.empty?
118
+ elsif !swift_pod_target.swift_version.nil? && swift_pod_target.swift_version.empty?
119
119
  "- `#{swift_pod_target.name}` does not specify a Swift version (#{swift_pod_target.spec_swift_versions.map { |v| "`#{v}`" }.to_sentence}) " \
120
120
  "that is satisfied by any of targets (#{swift_pod_target.target_definitions.map { |td| "`#{td.name}`" }.to_sentence}) integrating it."
121
121
  end
@@ -2,7 +2,6 @@ require 'cocoapods-core/source'
2
2
  require 'netrc'
3
3
  require 'set'
4
4
  require 'rest'
5
- require 'typhoeus'
6
5
  require 'yaml'
7
6
 
8
7
  module Pod
@@ -72,6 +71,8 @@ module Pod
72
71
  #
73
72
  def cdn_url?(url)
74
73
  if url =~ %r{^https?:\/\/}
74
+ require 'typhoeus'
75
+
75
76
  response = Typhoeus.get(url + '/CocoaPods-version.yml', :netrc_file => Netrc.default_path, :netrc => :optional)
76
77
  response.code == 200 && begin
77
78
  response_hash = YAML.load(response.body) # rubocop:disable Security/YAMLLoad
@@ -43,6 +43,11 @@ module Pod
43
43
  #
44
44
  attr_reader :application_extension_api_only
45
45
 
46
+ # @return [Boolean] whether the target must be compiled with Swift's library
47
+ # evolution support, necessary for XCFrameworks.
48
+ #
49
+ attr_reader :build_library_for_distribution
50
+
46
51
  # Initialize a new target
47
52
  #
48
53
  # @param [Sandbox] sandbox @see #sandbox
@@ -59,6 +64,7 @@ module Pod
59
64
  @build_type = build_type
60
65
 
61
66
  @application_extension_api_only = false
67
+ @build_library_for_distribution = false
62
68
  @build_settings = create_build_settings
63
69
  end
64
70
 
@@ -298,19 +304,55 @@ module Pod
298
304
  support_files_dir + "#{label}-dummy.m"
299
305
  end
300
306
 
301
- # mark the target as extension-only,
302
- # translates to APPLICATION_EXTENSION_API_ONLY = YES in the build settings
307
+ # Mark the target as extension-only.
308
+ # Translates to APPLICATION_EXTENSION_API_ONLY = YES in the build settings.
303
309
  #
304
310
  def mark_application_extension_api_only
305
311
  @application_extension_api_only = true
306
312
  end
307
313
 
314
+ # Compiles the target with Swift's library evolution support, necessary to
315
+ # build XCFrameworks.
316
+ # Translates to BUILD_LIBRARY_FOR_DISTRIBUTION = YES in the build settings.
317
+ #
318
+ def mark_build_library_for_distribution
319
+ @build_library_for_distribution = true
320
+ end
321
+
308
322
  # @return [Pathname] The absolute path of the prepare artifacts script.
309
323
  #
324
+ # @deprecated
325
+ #
326
+ # @todo Remove in 2.0
327
+ #
310
328
  def prepare_artifacts_script_path
311
329
  support_files_dir + "#{label}-artifacts.sh"
312
330
  end
313
331
 
332
+ # Returns an extension in the target that corresponds to the
333
+ # resource's input extension.
334
+ #
335
+ # @param [String] input_extension
336
+ # The input extension to map to.
337
+ #
338
+ # @return [String] The output extension.
339
+ #
340
+ def self.output_extension_for_resource(input_extension)
341
+ case input_extension
342
+ when '.storyboard' then '.storyboardc'
343
+ when '.xib' then '.nib'
344
+ when '.xcdatamodel' then '.mom'
345
+ when '.xcdatamodeld' then '.momd'
346
+ when '.xcmappingmodel' then '.cdm'
347
+ when '.xcassets' then '.car'
348
+ else input_extension
349
+ end
350
+ end
351
+
352
+ def self.resource_extension_compilable?(input_extension)
353
+ output_extension_for_resource(input_extension) != input_extension
354
+ end
355
+
314
356
  #-------------------------------------------------------------------------#
315
357
 
316
358
  private
@@ -98,6 +98,7 @@ module Pod
98
98
  target_definition, client_root, user_project, user_target_uuids, merged).tap do |aggregate_target|
99
99
  aggregate_target.search_paths_aggregate_targets.concat(search_paths_aggregate_targets).freeze
100
100
  aggregate_target.mark_application_extension_api_only if application_extension_api_only
101
+ aggregate_target.mark_build_library_for_distribution if build_library_for_distribution
101
102
  end
102
103
  end
103
104
 
@@ -284,6 +285,20 @@ module Pod
284
285
  resources_by_config[config] = targets.flat_map do |pod_target|
285
286
  library_specs = pod_target.library_specs.map(&:name)
286
287
  resource_paths = pod_target.resource_paths.values_at(*library_specs).flatten
288
+
289
+ if pod_target.build_as_static_framework?
290
+ built_product_dir = Pathname.new(pod_target.build_product_path('${BUILT_PRODUCTS_DIR}'))
291
+ resource_paths = resource_paths.map do |resource_path|
292
+ extname = File.extname(resource_path)
293
+ if self.class.resource_extension_compilable?(extname)
294
+ output_extname = self.class.output_extension_for_resource(extname)
295
+ built_product_dir.join(File.basename(resource_path, extname)).sub_ext(output_extname).to_s
296
+ else
297
+ resource_path
298
+ end
299
+ end
300
+ end
301
+
287
302
  resource_paths << bridge_support_file
288
303
  resource_paths.compact.uniq
289
304
  end
@@ -359,6 +374,10 @@ module Pod
359
374
  #
360
375
  # @return [Pathname] The absolute path of the prepare artifacts script input file list.
361
376
  #
377
+ # @deprecated
378
+ #
379
+ # @todo Remove in 2.0
380
+ #
362
381
  def prepare_artifacts_script_input_files_path(configuration)
363
382
  support_files_dir + "#{label}-artifacts-#{configuration}-input-files.xcfilelist"
364
383
  end
@@ -367,6 +386,10 @@ module Pod
367
386
  #
368
387
  # @return [Pathname] The absolute path of the prepare artifacts script output file list.
369
388
  #
389
+ # @deprecated
390
+ #
391
+ # @todo Remove in 2.0
392
+ #
370
393
  def prepare_artifacts_script_output_files_path(configuration)
371
394
  support_files_dir + "#{label}-artifacts-#{configuration}-output-files.xcfilelist"
372
395
  end
@@ -453,6 +476,10 @@ module Pod
453
476
  # @return [String] The path of the prepare artifacts script relative to the
454
477
  # root of the Pods project.
455
478
  #
479
+ # @deprecated
480
+ #
481
+ # @todo Remove in 2.0
482
+ #
456
483
  def prepare_artifacts_script_relative_path
457
484
  "${PODS_ROOT}/#{relative_to_pods_root(prepare_artifacts_script_path)}"
458
485
  end
@@ -460,6 +487,10 @@ module Pod
460
487
  # @return [String] The path of the prepare artifacts script input file list
461
488
  # relative to the root of the Pods project.
462
489
  #
490
+ # @deprecated
491
+ #
492
+ # @todo Remove in 2.0
493
+ #
463
494
  def prepare_artifacts_script_input_files_relative_path
464
495
  "${PODS_ROOT}/#{relative_to_pods_root(prepare_artifacts_script_input_files_path('${CONFIGURATION}'))}"
465
496
  end
@@ -467,6 +498,10 @@ module Pod
467
498
  # @return [String] The path of the prepare artifacts script output file list
468
499
  # relative to the root of the Pods project.
469
500
  #
501
+ # @deprecated
502
+ #
503
+ # @todo Remove in 2.0
504
+ #
470
505
  def prepare_artifacts_script_output_files_relative_path
471
506
  "${PODS_ROOT}/#{relative_to_pods_root(prepare_artifacts_script_output_files_path('${CONFIGURATION}'))}"
472
507
  end
@@ -43,7 +43,13 @@ module Pod
43
43
  # @return [String]
44
44
  # The variable for the configuration build directory used when building pod targets.
45
45
  #
46
- CONFIGURATION_BUILD_DIR_VARIABLE = '${PODS_CONFIGURATION_BUILD_DIR}'.freeze
46
+ CONFIGURATION_BUILD_DIR_VARIABLE = '${PODS_CONFIGURATION_BUILD_DIR}'
47
+
48
+ # @return [String]
49
+ # The variable for the configuration intermediate frameworks directory used for building pod targets
50
+ # that contain vendored xcframeworks.
51
+ #
52
+ XCFRAMEWORKS_BUILD_DIR_VARIABLE = '${PODS_XCFRAMEWORKS_BUILD_DIR}'
47
53
 
48
54
  #-------------------------------------------------------------------------#
49
55
 
@@ -95,7 +101,7 @@ module Pod
95
101
  from_search_paths_aggregate_targets: false, from_pod_targets_to_link: false,
96
102
  &implementation)
97
103
 
98
- memoized_key = "#{self}##{method_name}".freeze
104
+ memoized_key = "#{self}##{method_name}"
99
105
 
100
106
  (@build_settings_names ||= Set.new) << method_name.to_s.upcase if build_setting
101
107
 
@@ -134,6 +140,14 @@ module Pod
134
140
  end
135
141
  private_class_method :define_build_settings_method
136
142
 
143
+ # @param [XCFramework] xcframework the xcframework thats slice will be copied to the intermediates dir
144
+ #
145
+ # @return [String] the path to the directory containing the xcframework slice
146
+ #
147
+ def self.xcframework_intermediate_dir(xcframework)
148
+ "#{XCFRAMEWORKS_BUILD_DIR_VARIABLE}/#{xcframework.name}"
149
+ end
150
+
137
151
  class << self
138
152
  #-------------------------------------------------------------------------#
139
153
 
@@ -204,6 +218,10 @@ module Pod
204
218
  '${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
205
219
  end
206
220
 
221
+ define_build_settings_method :pods_xcframeworks_build_dir, :build_setting => true do
222
+ '$(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates'
223
+ end
224
+
207
225
  # @return [String]
208
226
  define_build_settings_method :use_recursive_script_inputs_in_script_phases, :build_setting => true do
209
227
  'YES'
@@ -314,6 +332,13 @@ module Pod
314
332
  false
315
333
  end
316
334
 
335
+ # Xcode 12 turns on this warning by default which is problematic for CocoaPods-generated
336
+ # imports which use double-quoted paths.
337
+ # @return [Boolean]
338
+ define_build_settings_method :clang_warn_quoted_include_in_framework_header, :build_setting => true do
339
+ 'NO'
340
+ end
341
+
317
342
  # @return [Array<String>]
318
343
  # the `LD_RUNPATH_SEARCH_PATHS` needed for dynamically linking the {#target}
319
344
  #
@@ -475,6 +500,14 @@ module Pod
475
500
  pod_targets - subset_targets
476
501
  end
477
502
 
503
+ # @param [Pathname,String] path the path to the xcframework bundle
504
+ #
505
+ # @return [Xcode::XCFramework] the xcframework at the given path
506
+ #
507
+ def load_xcframework(path)
508
+ Xcode::XCFramework.new(path)
509
+ end
510
+
478
511
  # A subclass that generates build settings for a {PodTarget}
479
512
  class PodTargetSettings < BuildSettings
480
513
  #-------------------------------------------------------------------------#
@@ -576,10 +609,13 @@ module Pod
576
609
  frameworks.concat consumer_frameworks
577
610
  if library_xcconfig?
578
611
  # We know that this library target is being built dynamically based
579
- # on the guard above, so include any vendored static frameworks.
612
+ # on the guard above, so include any vendored static frameworks and vendored xcframeworks.
580
613
  if target.should_build?
581
614
  frameworks.concat vendored_static_frameworks.map { |l| File.basename(l, '.framework') }
582
- frameworks.concat vendored_xcframeworks.map(&:name)
615
+ frameworks.concat vendored_xcframeworks.
616
+ select { |xcf| xcf.build_type.static_framework? }.
617
+ map(&:name).
618
+ uniq
583
619
  end
584
620
  # Also include any vendored dynamic frameworks of dependencies.
585
621
  frameworks.concat dependent_targets.reject(&:should_build?).flat_map { |pt| pt.build_settings[@configuration].dynamic_frameworks_to_import }
@@ -596,7 +632,7 @@ module Pod
596
632
  static_frameworks_to_import.concat vendored_static_frameworks.map { |f| File.basename(f, '.framework') } unless target.should_build? && target.build_as_dynamic?
597
633
  unless target.should_build? && target.build_as_dynamic?
598
634
  static_frameworks_to_import.concat vendored_xcframeworks.
599
- select(&:includes_static_slices?).
635
+ select { |xcf| xcf.build_type.static_framework? }.
600
636
  map(&:name).
601
637
  uniq
602
638
  end
@@ -608,7 +644,7 @@ module Pod
608
644
  define_build_settings_method :dynamic_frameworks_to_import, :memoized => true do
609
645
  dynamic_frameworks_to_import = vendored_dynamic_frameworks.map { |f| File.basename(f, '.framework') }
610
646
  dynamic_frameworks_to_import.concat vendored_xcframeworks.
611
- select(&:includes_dynamic_slices?).
647
+ select { |xcf| xcf.build_type.dynamic_framework? }.
612
648
  map(&:name).
613
649
  uniq
614
650
  dynamic_frameworks_to_import << target.product_basename if target.should_build? && target.build_as_dynamic_framework?
@@ -656,12 +692,11 @@ module Pod
656
692
  search_paths.concat file_accessors.
657
693
  flat_map(&:vendored_frameworks).
658
694
  map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
659
- # Include each slice in the framework search paths.
660
- # Xcode will not search inside an .xcframework for headers within each slice
661
- search_paths.concat vendored_xcframeworks.
662
- flat_map(&:slices).
663
- select { |slice| slice.platform.symbolic_name == target.platform.symbolic_name }.
664
- flat_map { |slice| File.join '${PODS_ROOT}', slice.path.dirname.relative_path_from(target.sandbox.root) }
695
+ xcframework_intermediates = vendored_xcframeworks.
696
+ select { |xcf| xcf.build_type.framework? }.
697
+ map { |xcf| BuildSettings.xcframework_intermediate_dir(xcf) }.
698
+ uniq
699
+ search_paths.concat xcframework_intermediates
665
700
  search_paths
666
701
  end
667
702
 
@@ -686,7 +721,7 @@ module Pod
686
721
 
687
722
  # @return [Array<Xcode::XCFramework>]
688
723
  define_build_settings_method :vendored_xcframeworks, :memoized => true do
689
- file_accessors.flat_map(&:vendored_xcframeworks).map { |path| Xcode::XCFramework.new(path) }
724
+ file_accessors.flat_map(&:vendored_xcframeworks).map { |path| load_xcframework(path) }
690
725
  end
691
726
 
692
727
  # @return [Array<String>]
@@ -707,7 +742,7 @@ module Pod
707
742
  # @return [Array<String>]
708
743
  #
709
744
  def linker_names_from_libraries(libraries)
710
- libraries.map { |l| File.basename(l, l.extname).sub(/\Alib/, '') }
745
+ libraries.map { |l| File.basename(l, File.extname(l)).sub(/\Alib/, '') }
711
746
  end
712
747
 
713
748
  # @return [Array<String>]
@@ -718,6 +753,11 @@ module Pod
718
753
  if non_library_xcconfig? || target.build_as_dynamic?
719
754
  libraries.concat linker_names_from_libraries(vendored_static_libraries)
720
755
  libraries.concat libraries_to_import
756
+ xcframework_libraries = vendored_xcframeworks.
757
+ select { |xcf| xcf.build_type.static_library? }.
758
+ map(&:name).
759
+ uniq
760
+ libraries.concat xcframework_libraries
721
761
  end
722
762
  if non_library_xcconfig?
723
763
  libraries.concat dependent_targets.flat_map { |pt| pt.build_settings[@configuration].dynamic_libraries_to_import }
@@ -729,7 +769,14 @@ module Pod
729
769
  # @return [Array<String>]
730
770
  define_build_settings_method :static_libraries_to_import, :memoized => true do
731
771
  static_libraries_to_import = []
732
- static_libraries_to_import.concat linker_names_from_libraries(vendored_static_libraries) unless target.should_build? && target.build_as_dynamic?
772
+ unless target.should_build? && target.build_as_dynamic?
773
+ static_libraries_to_import.concat linker_names_from_libraries(vendored_static_libraries)
774
+ xcframework_libraries = vendored_xcframeworks.
775
+ select { |xcf| xcf.build_type.static_library? }.
776
+ flat_map { |xcf| linker_names_from_libraries([xcf.slices.first.binary_path]) }.
777
+ uniq
778
+ static_libraries_to_import.concat linker_names_from_libraries(xcframework_libraries)
779
+ end
733
780
  static_libraries_to_import << target.product_basename if target.should_build? && target.build_as_static_library?
734
781
  static_libraries_to_import
735
782
  end
@@ -775,12 +822,20 @@ module Pod
775
822
 
776
823
  # @return [Array<String>]
777
824
  define_build_settings_method :vendored_static_library_search_paths, :memoized => true do
778
- vendored_static_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
825
+ paths = vendored_static_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
826
+ paths.concat vendored_xcframeworks.
827
+ select { |xcf| xcf.build_type.static_library? }.
828
+ map { |xcf| BuildSettings.xcframework_intermediate_dir(xcf) }
829
+ paths
779
830
  end
780
831
 
781
832
  # @return [Array<String>]
782
833
  define_build_settings_method :vendored_dynamic_library_search_paths, :memoized => true do
783
- vendored_dynamic_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
834
+ paths = vendored_dynamic_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
835
+ paths.concat vendored_xcframeworks.
836
+ select { |xcf| xcf.build_type.dynamic_library? }.
837
+ map { |xcf| BuildSettings.xcframework_intermediate_dir(xcf) }
838
+ paths
784
839
  end
785
840
 
786
841
  # @return [Array<String>]
@@ -912,6 +967,11 @@ module Pod
912
967
  target.application_extension_api_only ? 'YES' : nil
913
968
  end
914
969
 
970
+ # @return [String]
971
+ define_build_settings_method :build_library_for_distribution, :build_setting => true, :memoized => true do
972
+ target.build_library_for_distribution ? 'YES' : nil
973
+ end
974
+
915
975
  #-------------------------------------------------------------------------#
916
976
 
917
977
  # @!group Target Properties
@@ -1098,6 +1158,13 @@ module Pod
1098
1158
  select { |pt| pt.build_as_framework? && pt.should_build? }.
1099
1159
  map { |pt| pt.build_settings[@configuration].framework_header_search_path }
1100
1160
 
1161
+ xcframework_library_headers = pod_targets.flat_map { |pt| pt.build_settings[@configuration].vendored_xcframeworks }.
1162
+ select { |xcf| xcf.build_type.static_library? }.
1163
+ map { |xcf| "#{BuildSettings.xcframework_intermediate_dir(xcf)}/Headers" }.
1164
+ compact
1165
+
1166
+ paths.concat xcframework_library_headers
1167
+
1101
1168
  paths.concat target.search_paths_aggregate_targets.flat_map { |at| at.build_settings(configuration_name).header_search_paths }
1102
1169
 
1103
1170
  paths