Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Manifest.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,6 @@ lib/rubygems/resolver/installer_set.rb
lib/rubygems/resolver/local_specification.rb
lib/rubygems/resolver/lock_set.rb
lib/rubygems/resolver/lock_specification.rb
lib/rubygems/resolver/molinillo.rb
lib/rubygems/resolver/requirement_list.rb
lib/rubygems/resolver/set.rb
lib/rubygems/resolver/source_set.rb
Expand Down Expand Up @@ -608,6 +607,7 @@ lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb
lib/rubygems/vendor/uri/lib/uri/version.rb
lib/rubygems/vendor/uri/lib/uri/ws.rb
lib/rubygems/vendor/uri/lib/uri/wss.rb
lib/rubygems/vendored_molinillo.rb
lib/rubygems/version.rb
lib/rubygems/version_option.rb
lib/rubygems/yaml_serializer.rb
Expand Down
10 changes: 5 additions & 5 deletions lib/rubygems/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# all the requirements.

class Gem::Resolver
require_relative "resolver/molinillo"
require_relative "vendored_molinillo"

##
# If the DEBUG_RESOLVER environment variable is set then debugging mode is
Expand Down Expand Up @@ -167,7 +167,7 @@ def requests(s, act, reqs=[]) # :nodoc:
reqs
end

include Molinillo::UI
include Gem::Molinillo::UI

def output
@output ||= debug? ? $stdout : File.open(IO::NULL, "w")
Expand All @@ -177,14 +177,14 @@ def debug?
DEBUG_RESOLVER
end

include Molinillo::SpecificationProvider
include Gem::Molinillo::SpecificationProvider

##
# Proceed with resolution! Returns an array of ActivationRequest objects.

def resolve
Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.map(&:payload).compact
rescue Molinillo::VersionConflict => e
Gem::Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.map(&:payload).compact
rescue Gem::Molinillo::VersionConflict => e
conflict = e.conflicts.values.first
raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
ensure
Expand Down
3 changes: 0 additions & 3 deletions lib/rubygems/resolver/molinillo.rb

This file was deleted.

4 changes: 2 additions & 2 deletions lib/rubygems/vendor/molinillo/lib/molinillo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
require_relative 'molinillo/modules/ui'
require_relative 'molinillo/modules/specification_provider'

# Gem::Resolver::Molinillo is a generic dependency resolution algorithm.
module Gem::Resolver::Molinillo
# Gem::Molinillo is a generic dependency resolution algorithm.
module Gem::Molinillo
end
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
# @!visibility private
module Delegates
# Delegates all {Gem::Resolver::Molinillo::ResolutionState} methods to a `#state` property.
# Delegates all {Gem::Molinillo::ResolutionState} methods to a `#state` property.
module ResolutionState
# (see Gem::Resolver::Molinillo::ResolutionState#name)
# (see Gem::Molinillo::ResolutionState#name)
def name
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.name
end

# (see Gem::Resolver::Molinillo::ResolutionState#requirements)
# (see Gem::Molinillo::ResolutionState#requirements)
def requirements
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.requirements
end

# (see Gem::Resolver::Molinillo::ResolutionState#activated)
# (see Gem::Molinillo::ResolutionState#activated)
def activated
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.activated
end

# (see Gem::Resolver::Molinillo::ResolutionState#requirement)
# (see Gem::Molinillo::ResolutionState#requirement)
def requirement
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.requirement
end

# (see Gem::Resolver::Molinillo::ResolutionState#possibilities)
# (see Gem::Molinillo::ResolutionState#possibilities)
def possibilities
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.possibilities
end

# (see Gem::Resolver::Molinillo::ResolutionState#depth)
# (see Gem::Molinillo::ResolutionState#depth)
def depth
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.depth
end

# (see Gem::Resolver::Molinillo::ResolutionState#conflicts)
# (see Gem::Molinillo::ResolutionState#conflicts)
def conflicts
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.conflicts
end

# (see Gem::Resolver::Molinillo::ResolutionState#unused_unwind_options)
# (see Gem::Molinillo::ResolutionState#unused_unwind_options)
def unused_unwind_options
current_state = state || Gem::Resolver::Molinillo::ResolutionState.empty
current_state = state || Gem::Molinillo::ResolutionState.empty
current_state.unused_unwind_options
end
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
module Delegates
# Delegates all {Gem::Resolver::Molinillo::SpecificationProvider} methods to a
# Delegates all {Gem::Molinillo::SpecificationProvider} methods to a
# `#specification_provider` property.
module SpecificationProvider
# (see Gem::Resolver::Molinillo::SpecificationProvider#search_for)
# (see Gem::Molinillo::SpecificationProvider#search_for)
def search_for(dependency)
with_no_such_dependency_error_handling do
specification_provider.search_for(dependency)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#dependencies_for)
# (see Gem::Molinillo::SpecificationProvider#dependencies_for)
def dependencies_for(specification)
with_no_such_dependency_error_handling do
specification_provider.dependencies_for(specification)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#requirement_satisfied_by?)
# (see Gem::Molinillo::SpecificationProvider#requirement_satisfied_by?)
def requirement_satisfied_by?(requirement, activated, spec)
with_no_such_dependency_error_handling do
specification_provider.requirement_satisfied_by?(requirement, activated, spec)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#dependencies_equal?)
# (see Gem::Molinillo::SpecificationProvider#dependencies_equal?)
def dependencies_equal?(dependencies, other_dependencies)
with_no_such_dependency_error_handling do
specification_provider.dependencies_equal?(dependencies, other_dependencies)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#name_for)
# (see Gem::Molinillo::SpecificationProvider#name_for)
def name_for(dependency)
with_no_such_dependency_error_handling do
specification_provider.name_for(dependency)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#name_for_explicit_dependency_source)
# (see Gem::Molinillo::SpecificationProvider#name_for_explicit_dependency_source)
def name_for_explicit_dependency_source
with_no_such_dependency_error_handling do
specification_provider.name_for_explicit_dependency_source
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#name_for_locking_dependency_source)
# (see Gem::Molinillo::SpecificationProvider#name_for_locking_dependency_source)
def name_for_locking_dependency_source
with_no_such_dependency_error_handling do
specification_provider.name_for_locking_dependency_source
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#sort_dependencies)
# (see Gem::Molinillo::SpecificationProvider#sort_dependencies)
def sort_dependencies(dependencies, activated, conflicts)
with_no_such_dependency_error_handling do
specification_provider.sort_dependencies(dependencies, activated, conflicts)
end
end

# (see Gem::Resolver::Molinillo::SpecificationProvider#allow_missing?)
# (see Gem::Molinillo::SpecificationProvider#allow_missing?)
def allow_missing?(dependency)
with_no_such_dependency_error_handling do
specification_provider.allow_missing?(dependency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_relative 'dependency_graph/log'
require_relative 'dependency_graph/vertex'

module Gem::Resolver::Molinillo
module Gem::Molinillo
# A directed acyclic graph that is tuned to hold named dependencies
class DependencyGraph
include Enumerable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# An action that modifies a {DependencyGraph} that is reversible.
# @abstract
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# (see DependencyGraph#add_edge_no_circular)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# (see DependencyGraph#add_vertex)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# (see DependencyGraph#delete_edge)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# @see DependencyGraph#detach_vertex_named
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
require_relative 'set_payload'
require_relative 'tag'

module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# A log for dependency graph actions
class Log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# @see DependencyGraph#set_payload
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

require_relative 'action'
module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# @!visibility private
# @see DependencyGraph#tag
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
class DependencyGraph
# A vertex in a {DependencyGraph} that encapsulates a {#name} and a
# {#payload}
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/vendor/molinillo/lib/molinillo/errors.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
# An error that occurred during the resolution process
class ResolverError < StandardError; end

Expand Down
4 changes: 2 additions & 2 deletions lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
# The version of Gem::Resolver::Molinillo.
module Gem::Molinillo
# The version of Gem::Molinillo.
VERSION = '0.8.0'.freeze
end
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
# Provides information about specifications and dependencies to the resolver,
# allowing the {Resolver} class to remain generic while still providing power
# and flexibility.
#
# This module contains the methods that users of Gem::Resolver::Molinillo must to implement,
# This module contains the methods that users of Gem::Molinillo must to implement,
# using knowledge of their own model classes.
module SpecificationProvider
# Search for the specifications that match the given dependency.
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/vendor/molinillo/lib/molinillo/modules/ui.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
# Conveys information about the resolution process to a user.
module UI
# The {IO} object that should be used to print output. `STDOUT`, by default.
Expand Down
6 changes: 3 additions & 3 deletions lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
class Resolver
# A specific resolution from a given {Resolver}
class Resolution
Expand Down Expand Up @@ -244,8 +244,8 @@ def end_resolution
require_relative 'delegates/resolution_state'
require_relative 'delegates/specification_provider'

include Gem::Resolver::Molinillo::Delegates::ResolutionState
include Gem::Resolver::Molinillo::Delegates::SpecificationProvider
include Gem::Molinillo::Delegates::ResolutionState
include Gem::Molinillo::Delegates::SpecificationProvider

# Processes the topmost available {RequirementState} on the stack
# @return [void]
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/vendor/molinillo/lib/molinillo/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require_relative 'dependency_graph'

module Gem::Resolver::Molinillo
module Gem::Molinillo
# This class encapsulates a dependency resolver.
# The resolver is responsible for determining which set of dependencies to
# activate, with feedback from the {#specification_provider}
Expand Down
2 changes: 1 addition & 1 deletion lib/rubygems/vendor/molinillo/lib/molinillo/state.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

module Gem::Resolver::Molinillo
module Gem::Molinillo
# A state that a {Resolution} can be in
# @attr [String] name the name of the current requirement
# @attr [Array<Object>] requirements currently unsatisfied requirements
Expand Down
3 changes: 3 additions & 0 deletions lib/rubygems/vendored_molinillo.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require_relative "vendor/molinillo/lib/molinillo"
2 changes: 1 addition & 1 deletion tool/automatiek/vendor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def require_target

vendored_gems = [
# RubyGems
VendoredGem.new(name: "molinillo", namespace: "Molinillo", prefix: "Gem::Resolver", vendor_lib: "lib/rubygems/vendor/molinillo", license_path: "LICENSE", extra_dependencies: %w[tsort/lib/rubygems/vendor/tsort], patch_name: "molinillo-master.patch"),
VendoredGem.new(name: "molinillo", namespace: "Molinillo", prefix: "Gem", vendor_lib: "lib/rubygems/vendor/molinillo", license_path: "LICENSE", extra_dependencies: %w[tsort/lib/rubygems/vendor/tsort], patch_name: "molinillo-master.patch"),
VendoredGem.new(name: "net-http", namespace: "Net", prefix: "Gem", vendor_lib: "lib/rubygems/vendor/net-http", license_path: "LICENSE.txt", extra_dependencies: %w[net-protocol resolv timeout uri/lib/rubygems/vendor/uri], skip_dependencies: %w[uri], patch_name: "net-http-v0.4.0.patch"),
VendoredGem.new(name: "net-http-persistent", namespace: "Net::HTTP::Persistent", prefix: "Gem", vendor_lib: "bundler/lib/bundler/vendor/net-http-persistent", license_path: "README.rdoc", extra_dependencies: %w[net-http uri/lib/rubygems/vendor/uri], patch_name: "net-http-persistent-v4.0.2.patch"),
VendoredGem.new(name: "net-protocol", namespace: "Net", prefix: "Gem", vendor_lib: "lib/rubygems/vendor/net-protocol", license_path: "LICENSE.txt"),
Expand Down