Class: Pod::Installer::TargetUUIDGenerator

Inherits:
Xcodeproj::Project::UUIDGenerator
  • Object
show all
Defined in:
lib/cocoapods/installer/target_uuid_generator.rb

Overview

Generates stable UUIDs for Native Targets.

Instance Method Summary collapse

Instance Method Details

#generate_all_paths_by_objects(projects) ⇒ Object

This method override is used to ONLY generate stable UUIDs for PBXNativeTarget instances and their sibling PBXFileReference product reference in the project. Stable native target UUIDs are necessary for incremental installation because other projects reference the target and product reference by its UUID in the remoteGlobalIDString field.

Parameters:

  • projects (Array<Project>)

    The list of projects used to generate stabe target UUIDs.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/cocoapods/installer/target_uuid_generator.rb', line 13

def generate_all_paths_by_objects(projects)
  @paths_by_object = {}
  projects.each do |project|
    project_basename = project.path.basename.to_s
    project.objects.each do |object|
      @paths_by_object[object] = object.uuid
    end
    project.targets.each do |target|
      @paths_by_object[target] = Digest::MD5.hexdigest(project_basename + target.name).upcase
      if target.is_a? Xcodeproj::Project::Object::PBXNativeTarget
        @paths_by_object[target.product_reference] = Digest::MD5.hexdigest(project_basename + 'product_reference' + target.name).upcase
      end
    end
  end
end

#uuid_for_path(path) ⇒ Object



29
30
31
# File 'lib/cocoapods/installer/target_uuid_generator.rb', line 29

def uuid_for_path(path)
  path
end