cocoapods 1.5.3 → 1.6.0.beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +200 -0
  3. data/lib/cocoapods.rb +0 -1
  4. data/lib/cocoapods/command/init.rb +1 -1
  5. data/lib/cocoapods/command/install.rb +7 -0
  6. data/lib/cocoapods/command/lib/lint.rb +8 -1
  7. data/lib/cocoapods/command/outdated.rb +2 -7
  8. data/lib/cocoapods/command/repo/add.rb +1 -1
  9. data/lib/cocoapods/command/repo/list.rb +1 -1
  10. data/lib/cocoapods/command/repo/push.rb +17 -12
  11. data/lib/cocoapods/command/repo/remove.rb +1 -1
  12. data/lib/cocoapods/command/repo/update.rb +1 -1
  13. data/lib/cocoapods/command/setup.rb +1 -1
  14. data/lib/cocoapods/command/spec/create.rb +39 -39
  15. data/lib/cocoapods/command/spec/lint.rb +8 -1
  16. data/lib/cocoapods/config.rb +13 -2
  17. data/lib/cocoapods/downloader/cache.rb +1 -1
  18. data/lib/cocoapods/executable.rb +2 -2
  19. data/lib/cocoapods/external_sources.rb +7 -4
  20. data/lib/cocoapods/external_sources/abstract_external_source.rb +23 -13
  21. data/lib/cocoapods/gem_version.rb +1 -1
  22. data/lib/cocoapods/generator/acknowledgements/markdown.rb +6 -0
  23. data/lib/cocoapods/generator/acknowledgements/plist.rb +11 -0
  24. data/lib/cocoapods/generator/app_target_helper.rb +102 -16
  25. data/lib/cocoapods/generator/copy_resources_script.rb +6 -0
  26. data/lib/cocoapods/generator/dummy_source.rb +14 -5
  27. data/lib/cocoapods/generator/embed_frameworks_script.rb +13 -2
  28. data/lib/cocoapods/generator/header.rb +1 -1
  29. data/lib/cocoapods/generator/info_plist_file.rb +12 -4
  30. data/lib/cocoapods/generator/prefix_header.rb +2 -2
  31. data/lib/cocoapods/hooks_manager.rb +28 -17
  32. data/lib/cocoapods/installer.rb +103 -42
  33. data/lib/cocoapods/installer/analyzer.rb +362 -277
  34. data/lib/cocoapods/installer/analyzer/analysis_result.rb +52 -22
  35. data/lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb +9 -6
  36. data/lib/cocoapods/installer/analyzer/pod_variant.rb +4 -5
  37. data/lib/cocoapods/installer/analyzer/sandbox_analyzer.rb +3 -14
  38. data/lib/cocoapods/installer/analyzer/specs_state.rb +28 -4
  39. data/lib/cocoapods/installer/analyzer/target_inspection_result.rb +24 -16
  40. data/lib/cocoapods/installer/analyzer/target_inspector.rb +17 -11
  41. data/lib/cocoapods/installer/pod_source_installer.rb +31 -43
  42. data/lib/cocoapods/installer/post_install_hooks_context.rb +71 -46
  43. data/lib/cocoapods/installer/pre_install_hooks_context.rb +22 -13
  44. data/lib/cocoapods/installer/source_provider_hooks_context.rb +3 -1
  45. data/lib/cocoapods/installer/user_project_integrator.rb +0 -2
  46. data/lib/cocoapods/installer/user_project_integrator/target_integrator.rb +38 -28
  47. data/lib/cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator.rb +44 -11
  48. data/lib/cocoapods/installer/xcode/pods_project_generator.rb +129 -119
  49. data/lib/cocoapods/installer/xcode/pods_project_generator/aggregate_target_installer.rb +25 -16
  50. data/lib/cocoapods/installer/xcode/pods_project_generator/app_host_installer.rb +95 -0
  51. data/lib/cocoapods/installer/xcode/pods_project_generator/file_references_installer.rb +12 -45
  52. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_installer.rb +277 -169
  53. data/lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb +31 -24
  54. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installation_result.rb +93 -0
  55. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer.rb +60 -69
  56. data/lib/cocoapods/installer/xcode/pods_project_generator/target_installer_helper.rb +72 -0
  57. data/lib/cocoapods/installer/xcode/target_validator.rb +15 -9
  58. data/lib/cocoapods/project.rb +14 -14
  59. data/lib/cocoapods/resolver.rb +38 -50
  60. data/lib/cocoapods/sandbox.rb +22 -38
  61. data/lib/cocoapods/sandbox/file_accessor.rb +11 -6
  62. data/lib/cocoapods/sandbox/headers_store.rb +9 -8
  63. data/lib/cocoapods/sandbox/path_list.rb +5 -8
  64. data/lib/cocoapods/sources_manager.rb +1 -1
  65. data/lib/cocoapods/target.rb +92 -37
  66. data/lib/cocoapods/target/aggregate_target.rb +140 -84
  67. data/lib/cocoapods/target/build_settings.rb +1076 -0
  68. data/lib/cocoapods/target/pod_target.rb +198 -294
  69. data/lib/cocoapods/user_interface.rb +5 -0
  70. data/lib/cocoapods/validator.rb +133 -41
  71. metadata +18 -18
  72. data/lib/cocoapods/generator/xcconfig.rb +0 -13
  73. data/lib/cocoapods/generator/xcconfig/aggregate_xcconfig.rb +0 -260
  74. data/lib/cocoapods/generator/xcconfig/pod_xcconfig.rb +0 -87
  75. data/lib/cocoapods/generator/xcconfig/xcconfig_helper.rb +0 -558
@@ -34,7 +34,7 @@ module Pod
34
34
  def validate!
35
35
  verify_no_duplicate_framework_and_library_names
36
36
  verify_no_static_framework_transitive_dependencies
37
- verify_no_pods_used_with_multiple_swift_versions
37
+ verify_swift_pods_swift_version
38
38
  verify_swift_pods_have_module_dependencies
39
39
  end
40
40
 
@@ -91,22 +91,28 @@ module Pod
91
91
  end
92
92
  end
93
93
 
94
- def verify_no_pods_used_with_multiple_swift_versions
95
- error_message_for_target = lambda do |target|
96
- "#{target.name} (Swift #{target.swift_version})"
94
+ def verify_swift_pods_swift_version
95
+ error_message_for_target_definition = lambda do |target_definition|
96
+ "`#{target_definition.name}` (Swift #{target_definition.swift_version})"
97
97
  end
98
98
  swift_pod_targets = pod_targets.select(&:uses_swift?)
99
99
  error_messages = swift_pod_targets.map do |pod_target|
100
100
  next unless pod_target.spec_swift_version.nil?
101
101
  swift_target_definitions = pod_target.target_definitions.reject { |target| target.swift_version.blank? }
102
- next if swift_target_definitions.empty? || swift_target_definitions.uniq(&:swift_version).count == 1
103
- target_errors = swift_target_definitions.map(&error_message_for_target).join(', ')
104
- "- #{pod_target.name} required by #{target_errors}"
102
+ next if swift_target_definitions.uniq(&:swift_version).count == 1
103
+ if swift_target_definitions.empty?
104
+ "- `#{pod_target.name}` does not specify a Swift version and none of the targets " \
105
+ "(#{pod_target.target_definitions.map { |td| "`#{td.name}`" }.to_sentence}) integrating it have the " \
106
+ '`SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at ' \
107
+ 'least one of the targets that integrate this pod.'
108
+ else
109
+ target_errors = swift_target_definitions.map(&error_message_for_target_definition).to_sentence
110
+ "- `#{pod_target.name}` is integrated by multiple targets that use a different Swift version: #{target_errors}."
111
+ end
105
112
  end.compact
106
113
 
107
114
  unless error_messages.empty?
108
- raise Informative, 'The following pods are integrated into targets ' \
109
- "that do not have the same Swift version:\n\n#{error_messages.join("\n")}"
115
+ raise Informative, "Unable to determine Swift version for the following pods:\n\n #{error_messages.join('\n')}"
110
116
  end
111
117
  end
112
118
 
@@ -8,9 +8,22 @@ module Pod
8
8
  # through the installation process.
9
9
  #
10
10
  class Project < Xcodeproj::Project
11
+ # @return [PBXGroup] The group for the support files of the aggregate
12
+ # targets.
13
+ #
14
+ attr_reader :support_files_group
15
+
16
+ # @return [PBXGroup] The group for the Pods.
17
+ #
18
+ attr_reader :pods
19
+
20
+ # @return [PBXGroup] The group for Development Pods.
21
+ #
22
+ attr_reader :development_pods
23
+
11
24
  # Initialize a new instance
12
25
  #
13
- # @param [Pathname, String] path @see path
26
+ # @param [Pathname, String] path @see #path
14
27
  # @param [Bool] skip_initialization
15
28
  # Whether the project should be initialized from scratch.
16
29
  # @param [Int] object_version
@@ -27,19 +40,6 @@ module Pod
27
40
  self.symroot = LEGACY_BUILD_ROOT
28
41
  end
29
42
 
30
- # @return [PBXGroup] The group for the support files of the aggregate
31
- # targets.
32
- #
33
- attr_reader :support_files_group
34
-
35
- # @return [PBXGroup] The group for the Pods.
36
- #
37
- attr_reader :pods
38
-
39
- # @return [PBXGroup] The group for Development Pods.
40
- #
41
- attr_reader :development_pods
42
-
43
43
  # Generates a list of new UUIDs that created objects can be assigned.
44
44
  #
45
45
  # @note Overridden to generate UUIDs in a much faster way, since we don't need to check for collisions
@@ -133,19 +133,16 @@ module Pod
133
133
  #
134
134
  def resolver_specs_by_target
135
135
  @resolver_specs_by_target ||= {}.tap do |resolver_specs_by_target|
136
- dependencies = {}
137
136
  @podfile_dependency_cache.target_definition_list.each do |target|
138
- specs = @podfile_dependency_cache.target_definition_dependencies(target).flat_map do |dep|
139
- name = dep.name
140
- node = @activated.vertex_named(name)
141
- (valid_dependencies_for_target_from_node(target, dependencies, node) << node).map { |s| [s, node.payload.test_specification?] }
142
- end
137
+ # can't use vertex.root? since that considers _all_ targets
138
+ explicit_dependencies = @podfile_dependency_cache.target_definition_dependencies(target).map(&:name).to_set
139
+ vertices = valid_dependencies_for_target(target)
143
140
 
144
- resolver_specs_by_target[target] = specs.
145
- group_by(&:first).
146
- map do |vertex, spec_test_only_tuples|
147
- test_only = spec_test_only_tuples.all? { |tuple| tuple[1] }
141
+ resolver_specs_by_target[target] = vertices.
142
+ map do |vertex|
148
143
  payload = vertex.payload
144
+ test_only = (!explicit_dependencies.include?(vertex.name) || payload.test_specification?) &&
145
+ (vertex.recursive_predecessors & vertices).all? { |v| !explicit_dependencies.include?(v.name) || v.payload.test_specification? }
149
146
  spec_source = payload.respond_to?(:spec_source) && payload.spec_source
150
147
  ResolverSpecification.new(payload, test_only, spec_source)
151
148
  end.
@@ -235,31 +232,29 @@ module Pod
235
232
  def requirement_satisfied_by?(requirement, activated, spec)
236
233
  version = spec.version
237
234
  return false unless requirement.requirement.satisfied_by?(version)
238
- shared_possibility_versions, prerelease_requirement = possibility_versions_for_root_name(requirement, activated)
239
- return false if !shared_possibility_versions.empty? && !shared_possibility_versions.include?(version)
240
- return false if version.prerelease? && !prerelease_requirement
235
+ return false unless valid_possibility_version_for_root_name?(requirement, activated, spec)
241
236
  return false unless spec_is_platform_compatible?(activated, requirement, spec)
242
237
  true
243
238
  end
244
239
 
245
- def possibility_versions_for_root_name(requirement, activated)
246
- prerelease_requirement = requirement.prerelease? || requirement.external_source
247
- existing = activated.vertices.values.flat_map do |vertex|
240
+ def valid_possibility_version_for_root_name?(requirement, activated, spec)
241
+ prerelease_requirement = requirement.prerelease? || requirement.external_source || !spec.version.prerelease?
242
+
243
+ activated.each do |vertex|
248
244
  next unless vertex.payload
249
245
  next unless Specification.root_name(vertex.name) == requirement.root_name
250
246
 
251
247
  prerelease_requirement ||= vertex.requirements.any? { |r| r.prerelease? || r.external_source }
252
248
 
253
- if vertex.payload.respond_to?(:possibilities)
254
- vertex.payload.possibilities.map(&:version)
255
- else
256
- vertex.payload.version
249
+ if vertex.payload.respond_to?(:version)
250
+ return true if vertex.payload.version == spec.version
251
+ break
257
252
  end
258
- end.compact
253
+ end
259
254
 
260
- [existing, prerelease_requirement]
255
+ prerelease_requirement
261
256
  end
262
- private :possibility_versions_for_root_name
257
+ private :valid_possibility_version_for_root_name?
263
258
 
264
259
  # Sort dependencies so that the ones that are easiest to resolve are first.
265
260
  # Easiest to resolve is (usually) defined by:
@@ -455,11 +450,6 @@ module Pod
455
450
 
456
451
  # Handles errors that come out of a {Molinillo::Resolver}.
457
452
  #
458
- # @todo The check for version conflicts coming from the {Lockfile}
459
- # requiring a pre-release version can be deleted for version 1.0,
460
- # as it is a migration step for Lockfiles coming from CocoaPods
461
- # versions before `0.35.0`.
462
- #
463
453
  # @return [void]
464
454
  #
465
455
  # @param [Molinillo::ResolverError] error
@@ -475,16 +465,7 @@ module Pod
475
465
  :version_for_spec => lambda(&:version),
476
466
  :additional_message_for_conflict => lambda do |o, name, conflict|
477
467
  local_pod_parent = conflict.requirement_trees.flatten.reverse.find(&:local?)
478
- lockfile_reqs = conflict.requirements[name_for_locking_dependency_source]
479
- if lockfile_reqs && lockfile_reqs.last && lockfile_reqs.last.prerelease? && !conflict.existing
480
- o << "\nDue to the previous naïve CocoaPods resolver, " \
481
- "you were using a pre-release version of `#{name}`, " \
482
- 'without explicitly asking for a pre-release version, which now leads to a conflict. ' \
483
- 'Please decide to either use that pre-release version by adding the ' \
484
- 'version requirement to your Podfile ' \
485
- "(e.g. `pod '#{name}', '#{lockfile_reqs.map(&:requirement).join("', '")}'`) " \
486
- "or revert to a stable version by running `pod update #{name}`."
487
- elsif local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility && conflict.locked_requirement
468
+ if local_pod_parent && !specifications_for_dependency(conflict.requirement).empty? && !conflict.possibility && conflict.locked_requirement
488
469
  # Conflict was caused by a requirement from a local dependency.
489
470
  # Tell user to use `pod update`.
490
471
  o << "\nIt seems like you've changed the constraints of dependency `#{name}` " \
@@ -543,8 +524,12 @@ module Pod
543
524
  #
544
525
  # @return [Bool]
545
526
  def spec_is_platform_compatible?(dependency_graph, dependency, spec)
527
+ # This is safe since a pod will only be in locked dependencies if we're
528
+ # using the same exact version
529
+ return true if locked_dependencies.vertex_named(spec.name)
530
+
546
531
  vertex = dependency_graph.vertex_named(dependency.name)
547
- predecessors = vertex.recursive_predecessors.select(&:root)
532
+ predecessors = vertex.recursive_predecessors.select(&:root?)
548
533
  predecessors << vertex if vertex.root?
549
534
  platforms_to_satisfy = predecessors.flat_map(&:explicit_requirements).flat_map { |r| @platforms_by_dependency[r] }.uniq
550
535
 
@@ -566,18 +551,21 @@ module Pod
566
551
  # An array of target-appropriate nodes whose `payload`s are
567
552
  # dependencies for `target`.
568
553
  #
569
- def valid_dependencies_for_target_from_node(target, dependencies, node)
570
- dependencies[[node.name, target.platform]] ||= begin
571
- validate_platform(node.payload, target)
572
- dependency_nodes = []
573
- node.outgoing_edges.each do |edge|
574
- next unless edge_is_valid_for_target_platform?(edge, target.platform)
575
- dependency_nodes << edge.destination
576
- end
554
+ def valid_dependencies_for_target(target)
555
+ dependencies = Set.new
556
+ @podfile_dependency_cache.target_definition_dependencies(target).each do |dep|
557
+ node = @activated.vertex_named(dep.name)
558
+ add_valid_dependencies_from_node(node, target, dependencies)
559
+ end
560
+ dependencies
561
+ end
577
562
 
578
- dependency_nodes.flat_map do |item|
579
- valid_dependencies_for_target_from_node(target, dependencies, item)
580
- end.concat dependency_nodes
563
+ def add_valid_dependencies_from_node(node, target, dependencies)
564
+ return unless dependencies.add?(node)
565
+ validate_platform(node.payload, target)
566
+ node.outgoing_edges.each do |edge|
567
+ next unless edge_is_valid_for_target_platform?(edge, target.platform)
568
+ add_valid_dependencies_from_node(edge.destination, target, dependencies)
581
569
  end
582
570
  end
583
571
 
@@ -52,7 +52,7 @@ module Pod
52
52
 
53
53
  # Initialize a new instance
54
54
  #
55
- # @param [String, Pathname] root @see root
55
+ # @param [String, Pathname] root @see #root
56
56
  #
57
57
  def initialize(root)
58
58
  FileUtils.mkdir_p(root)
@@ -62,6 +62,7 @@ module Pod
62
62
  @checkout_sources = {}
63
63
  @development_pods = {}
64
64
  @pods_with_absolute_path = []
65
+ @stored_podspecs = {}
65
66
  end
66
67
 
67
68
  # @return [Lockfile] the manifest which contains the information about the
@@ -209,9 +210,9 @@ module Pod
209
210
  # @return [Specification] the specification if the file is found.
210
211
  #
211
212
  def specification(name)
212
- if file = specification_path(name)
213
- original_path = development_pods[name]
214
- Specification.from_file(original_path || file)
213
+ @stored_podspecs[name] ||= if file = specification_path(name)
214
+ original_path = development_pods[name]
215
+ Specification.from_file(original_path || file)
215
216
  end
216
217
  end
217
218
 
@@ -242,7 +243,7 @@ module Pod
242
243
  # @param [String] name
243
244
  # the name of the pod
244
245
  #
245
- # @param [String, Pathname] podspec
246
+ # @param [String, Pathname, Specification] podspec
246
247
  # The contents of the specification (String) or the path to a
247
248
  # podspec file (Pathname).
248
249
  #
@@ -252,23 +253,31 @@ module Pod
252
253
  def store_podspec(name, podspec, _external_source = false, json = false)
253
254
  file_name = json ? "#{name}.podspec.json" : "#{name}.podspec"
254
255
  output_path = specifications_root + file_name
255
- output_path.dirname.mkpath
256
- if podspec.is_a?(String)
256
+
257
+ case podspec
258
+ when String
257
259
  output_path.open('w') { |f| f.puts(podspec) }
258
- else
260
+ when Pathname
259
261
  unless podspec.exist?
260
262
  raise Informative, "No podspec found for `#{name}` in #{podspec}"
261
263
  end
264
+ spec = Specification.from_file(podspec)
262
265
  FileUtils.copy(podspec, output_path)
266
+ when Specification
267
+ raise ArgumentError, 'can only store Specification objects as json' unless json
268
+ output_path.open('w') { |f| f.puts(podspec.to_pretty_json) }
269
+ spec = podspec.dup
270
+ else
271
+ raise ArgumentError, "Unknown type for podspec: #{podspec.inspect}"
263
272
  end
264
273
 
265
- Dir.chdir(podspec.is_a?(Pathname) ? File.dirname(podspec) : Dir.pwd) do
266
- spec = Specification.from_file(output_path)
274
+ spec ||= Specification.from_file(output_path)
275
+ spec.defined_in_file ||= output_path
267
276
 
268
- unless spec.name == name
269
- raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
270
- end
277
+ unless spec.name == name
278
+ raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
271
279
  end
280
+ @stored_podspecs[spec.name] = spec
272
281
  end
273
282
 
274
283
  #-------------------------------------------------------------------------#
@@ -367,8 +376,6 @@ module Pod
367
376
  # @return [Hash{String=>Pathname}] The path of the Pods' podspecs with a local source
368
377
  # grouped by their root name.
369
378
  #
370
- # @todo Rename (e.g. `pods_with_local_path`)
371
- #
372
379
  attr_reader :development_pods
373
380
 
374
381
  # Checks if a Pod is locally sourced?
@@ -393,28 +400,5 @@ module Pod
393
400
  end
394
401
 
395
402
  #-------------------------------------------------------------------------#
396
-
397
- public
398
-
399
- # @!group Pods Helpers
400
-
401
- # Creates the file accessors for the given Pod Targets.
402
- #
403
- # @param [Array<PodTarget>] pod_targets
404
- # The Pod Targets to create file accessors for.
405
- #
406
- def create_file_accessors(pod_targets)
407
- pod_targets.each do |pod_target|
408
- pod_root = pod_dir(pod_target.root_spec.name)
409
- path_list = PathList.new(pod_root)
410
- file_accessors = pod_target.specs.map do |spec|
411
- FileAccessor.new(path_list, spec.consumer(pod_target.platform))
412
- end
413
- pod_target.file_accessors ||= []
414
- pod_target.file_accessors.concat(file_accessors)
415
- end
416
- end
417
-
418
- #-------------------------------------------------------------------------#
419
403
  end
420
404
  end
@@ -1,4 +1,4 @@
1
- autoload :MachO, 'macho'
1
+ require 'macho'
2
2
 
3
3
  module Pod
4
4
  class Sandbox
@@ -33,8 +33,8 @@ module Pod
33
33
 
34
34
  # Initialize a new instance
35
35
  #
36
- # @param [Sandbox::PathList, Pathname] path_list @see path_list
37
- # @param [Specification::Consumer] spec_consumer @see spec_consumer
36
+ # @param [Sandbox::PathList, Pathname] path_list @see #path_list
37
+ # @param [Specification::Consumer] spec_consumer @see #spec_consumer
38
38
  #
39
39
  def initialize(path_list, spec_consumer)
40
40
  if path_list.is_a?(PathList)
@@ -106,6 +106,13 @@ module Pod
106
106
  source_files - arc_source_files
107
107
  end
108
108
 
109
+ # @return [Array<Pathname] the source files that do not match any of the
110
+ # recognized file extensions
111
+ def other_source_files
112
+ extensions = SOURCE_FILE_EXTENSIONS
113
+ source_files.reject { |f| extensions.include?(f.extname) }
114
+ end
115
+
109
116
  # @return [Array<Pathname>] the headers of the specification.
110
117
  #
111
118
  def headers
@@ -413,9 +420,7 @@ module Pod
413
420
  #
414
421
  def expanded_paths(patterns, options = {})
415
422
  return [] if patterns.empty?
416
- result = []
417
- result << path_list.glob(patterns, options)
418
- result.flatten.compact.uniq
423
+ path_list.glob(patterns, options).flatten.compact.uniq
419
424
  end
420
425
 
421
426
  # @param [Pathname] binary
@@ -16,7 +16,7 @@ module Pod
16
16
  #
17
17
  attr_reader :sandbox
18
18
 
19
- # @param [Sandbox] @see sandbox
19
+ # @param [Sandbox] @see #sandbox
20
20
  #
21
21
  # @param [String] relative_path
22
22
  # the relative path to the sandbox root and hence to the Pods
@@ -54,7 +54,7 @@ module Pod
54
54
  return @search_paths_cache[key] if @search_paths_cache.key?(key)
55
55
  search_paths = @search_paths.select do |entry|
56
56
  matches_platform = entry[:platform] == platform.name
57
- matches_target = target_name.nil? || (entry[:path].basename.to_s == target_name)
57
+ matches_target = target_name.nil? || (File.basename(entry[:path]) == target_name)
58
58
  matches_platform && matches_target
59
59
  end
60
60
  headers_dir = root.relative_path_from(sandbox.root).dirname
@@ -63,7 +63,7 @@ module Pod
63
63
  paths << "${PODS_ROOT}/#{headers_dir}/#{@relative_path}" if !use_modular_headers || @visibility_scope == :public
64
64
  paths << "${PODS_ROOT}/#{headers_dir}/#{entry[:path]}" if !use_modular_headers || @visibility_scope == :private
65
65
  paths
66
- end.uniq
66
+ end.tap(&:uniq!).freeze
67
67
  end
68
68
 
69
69
  # Removes the directory as it is regenerated from scratch during each
@@ -96,8 +96,9 @@ module Pod
96
96
  # @return [Array<Pathname>]
97
97
  #
98
98
  def add_files(namespace, relative_header_paths)
99
+ root.join(namespace).mkpath unless relative_header_paths.empty?
99
100
  relative_header_paths.map do |relative_header_path|
100
- add_file(namespace, relative_header_path)
101
+ add_file(namespace, relative_header_path, :mkdir => false)
101
102
  end
102
103
  end
103
104
 
@@ -115,9 +116,9 @@ module Pod
115
116
  #
116
117
  # @return [Pathname]
117
118
  #
118
- def add_file(namespace, relative_header_path)
119
+ def add_file(namespace, relative_header_path, mkdir: true)
119
120
  namespaced_path = root + namespace
120
- namespaced_path.mkpath unless File.exist?(namespaced_path)
121
+ namespaced_path.mkpath if mkdir
121
122
 
122
123
  absolute_source = (sandbox.root + relative_header_path)
123
124
  source = absolute_source.relative_path_from(namespaced_path)
@@ -128,7 +129,7 @@ module Pod
128
129
  # Adds an header search path to the sandbox.
129
130
  #
130
131
  # @param [Pathname] path
131
- # the path tho add.
132
+ # the path to add.
132
133
  #
133
134
  # @param [String] platform
134
135
  # the platform the search path applies to
@@ -136,7 +137,7 @@ module Pod
136
137
  # @return [void]
137
138
  #
138
139
  def add_search_path(path, platform)
139
- @search_paths << { :platform => platform.name, :path => (Pathname.new(@relative_path) + path) }
140
+ @search_paths << { :platform => platform.name, :path => File.join(@relative_path, path) }
140
141
  end
141
142
 
142
143
  #-----------------------------------------------------------------------#