Module: Pod::Installer::Analyzer::LockingDependencyAnalyzer

Defined in:
lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb

Overview

Generates dependencies that require the specific version of the Pods that haven’t changed in the Lockfile.

Class Method Summary collapse

Class Method Details

.generate_version_locking_dependencies(lockfile, pods_to_update) ⇒ Molinillo::DependencyGraph<Dependency>

Generates dependencies that require the specific version of the Pods that haven’t changed in the Lockfile.

These dependencies are passed to the Resolver, unless the installer is in update mode, to prevent it from upgrading the Pods that weren’t changed in the Podfile.

Returns:

  • (Molinillo::DependencyGraph<Dependency>)

    the dependencies generated by the lockfile that prevent the resolver to update a Pod.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb', line 20

def self.generate_version_locking_dependencies(lockfile, pods_to_update)
  dependency_graph = Molinillo::DependencyGraph.new

  if lockfile
    explicit_dependencies = lockfile.to_hash['DEPENDENCIES'] || []
    explicit_dependencies.each do |string|
      dependency = Dependency.new(string)
      dependency_graph.add_root_vertex(dependency.name, nil)
    end

    pods = lockfile.to_hash['PODS'] || []
    pods.each do |pod|
      add_to_dependency_graph(pod, [], dependency_graph)
    end

    pods_to_update = pods_to_update.flat_map do |u|
      root_name = Specification.root_name(u).downcase
      dependency_graph.vertices.keys.select { |n| Specification.root_name(n).downcase == root_name }
    end

    pods_to_update.each do |u|
      dependency_graph.detach_vertex_named(u)
    end
  end

  dependency_graph
end

.unlocked_dependency_graphMolinillo::DependencyGraph<Dependency>

Generates a completely ‘unlocked’ dependency graph.

Returns:

  • (Molinillo::DependencyGraph<Dependency>)

    an empty dependency graph



53
54
55
# File 'lib/cocoapods/installer/analyzer/locking_dependency_analyzer.rb', line 53

def self.unlocked_dependency_graph
  Molinillo::DependencyGraph.new
end