Class: Molinillo::Resolver::Resolution

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

Overview

A specific resolution from a given 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

Returns a new instance of Resolution.

Parameters:



37
38
39
40
41
42
43
44
# File 'lib/molinillo/resolution.rb', line 37

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’



27
28
29
# File 'lib/molinillo/resolution.rb', line 27

def base
  @base
end

#original_requestedArray (readonly)

Returns the dependencies that were explicitly required.

Returns:

  • (Array)

    the dependencies that were explicitly required



30
31
32
# File 'lib/molinillo/resolution.rb', line 30

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



23
24
25
# File 'lib/molinillo/resolution.rb', line 23

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.



19
20
21
# File 'lib/molinillo/resolution.rb', line 19

def specification_provider
  @specification_provider
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:



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/molinillo/resolution.rb', line 51

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 (#{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