Class: Gem::Resolver::Molinillo::Resolver::Resolution

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb

Overview

A specific resolution from a given Gem::Resolver::Molinillo::Resolver

Defined Under Namespace

Classes: Conflict

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specification_provider, resolver_ui, requested, base) ⇒ Resolution

Initializes a new resolution.

Parameters:



48
49
50
51
52
53
54
55
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 48

def initialize(specification_provider, resolver_ui, requested, base)
  @specification_provider = specification_provider
  @resolver_ui = resolver_ui
  @original_requested = requested
  @base = base
  @states = []
  @iteration_counter = 0
end

Instance Attribute Details

#baseDependencyGraph (readonly)

Returns the base dependency graph to which dependencies should be ‘locked’.

Returns:

  • (DependencyGraph)

    the base dependency graph to which dependencies should be ‘locked’



37
38
39
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 37

def base
  @base
end

#iteration_rate=(value) ⇒ Integer

Returns the number of resolver iterations in between calls to #resolver_ui‘s UI#indicate_progress method.

Returns:



82
83
84
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 82

def iteration_rate=(value)
  @iteration_rate = value
end

#original_requestedArray (readonly)

Returns the dependencies that were explicitly required.

Returns:

  • (Array)

    the dependencies that were explicitly required



40
41
42
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 40

def original_requested
  @original_requested
end

#resolver_uiUI (readonly)

Returns the UI that knows how to communicate feedback about the resolution process back to the user.

Returns:

  • (UI)

    the UI that knows how to communicate feedback about the resolution process back to the user



33
34
35
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 33

def resolver_ui
  @resolver_ui
end

#specification_providerSpecificationProvider (readonly)

Returns the provider that knows about dependencies, requirements, specifications, versions, etc.

Returns:

  • (SpecificationProvider)

    the provider that knows about dependencies, requirements, specifications, versions, etc.



29
30
31
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 29

def specification_provider
  @specification_provider
end

#started_at=(value) ⇒ Time

Returns the time at which resolution began.

Returns:

  • (Time)

    the time at which resolution began



86
87
88
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 86

def started_at=(value)
  @started_at = value
end

#states=(value) ⇒ Array<ResolutionState>

Returns the stack of states for the resolution.

Returns:



90
91
92
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 90

def states=(value)
  @states = value
end

Instance Method Details

#resolveDependencyGraph

Resolves the #original_requested dependencies into a full dependency

graph

Returns:

  • (DependencyGraph)

    the dependency graph of successfully resolved dependencies

Raises:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rubygems/resolver/molinillo/lib/molinillo/resolution.rb', line 62

def resolve
  start_resolution

  while state
    break unless state.requirements.any? || state.requirement
    indicate_progress
    if state.respond_to?(:pop_possibility_state) # DependencyState
      debug(depth) { "Creating possibility state for #{requirement} (#{possibilities.count} remaining)" }
      state.pop_possibility_state.tap { |s| states.push(s) if s }
    end
    process_topmost_state
  end

  activated.freeze
ensure
  end_resolution
end