Revert "Refactor incomplete specs handling"
This reverts commit 69580f8b72f41c58cae57d1ada4db909922b3891.
This commit is contained in:
parent
192a3a6bfb
commit
c257380965
@ -62,7 +62,6 @@ module Bundler
|
|||||||
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
|
||||||
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
|
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
|
||||||
autoload :Graph, File.expand_path("bundler/graph", __dir__)
|
autoload :Graph, File.expand_path("bundler/graph", __dir__)
|
||||||
autoload :IncompleteSpecification, File.expand_path("bundler/incomplete_specification", __dir__)
|
|
||||||
autoload :Index, File.expand_path("bundler/index", __dir__)
|
autoload :Index, File.expand_path("bundler/index", __dir__)
|
||||||
autoload :Injector, File.expand_path("bundler/injector", __dir__)
|
autoload :Injector, File.expand_path("bundler/injector", __dir__)
|
||||||
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
autoload :Installer, File.expand_path("bundler/installer", __dir__)
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Bundler
|
|
||||||
#
|
|
||||||
# Represents a package name that was found to be incomplete when trying to
|
|
||||||
# materialize a fresh resolution or the lockfile.
|
|
||||||
#
|
|
||||||
# Holds the actual partially complete set of specifications for the name.
|
|
||||||
# These are used so that they can be unlocked in a future resolution, and fix
|
|
||||||
# the situation.
|
|
||||||
#
|
|
||||||
class IncompleteSpecification
|
|
||||||
attr_reader :name, :partially_complete_specs
|
|
||||||
|
|
||||||
def initialize(name, partially_complete_specs = [])
|
|
||||||
@name = name
|
|
||||||
@partially_complete_specs = partially_complete_specs
|
|
||||||
end
|
|
||||||
|
|
||||||
def ==(other)
|
|
||||||
partially_complete_specs == other.partially_complete_specs
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -34,11 +34,9 @@ module Bundler
|
|||||||
@base[name]
|
@base[name]
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete(incomplete_specs)
|
def delete(specs)
|
||||||
incomplete_specs.each do |incomplete_spec|
|
specs.each do |spec|
|
||||||
incomplete_spec.partially_complete_specs.each do |spec|
|
@base.delete(spec)
|
||||||
@base.delete(spec)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -7,8 +7,11 @@ module Bundler
|
|||||||
include Enumerable
|
include Enumerable
|
||||||
include TSort
|
include TSort
|
||||||
|
|
||||||
def initialize(specs)
|
attr_reader :incomplete_specs
|
||||||
|
|
||||||
|
def initialize(specs, incomplete_specs = [])
|
||||||
@specs = specs
|
@specs = specs
|
||||||
|
@incomplete_specs = incomplete_specs
|
||||||
end
|
end
|
||||||
|
|
||||||
def for(dependencies, check = false, platforms = [nil])
|
def for(dependencies, check = false, platforms = [nil])
|
||||||
@ -42,7 +45,7 @@ module Bundler
|
|||||||
end
|
end
|
||||||
|
|
||||||
if incomplete && check
|
if incomplete && check
|
||||||
specs << IncompleteSpecification.new(name, lookup[name])
|
@incomplete_specs += lookup[name].any? ? lookup[name] : [LazySpecification.new(name, nil, nil)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,7 +84,7 @@ module Bundler
|
|||||||
def materialize(deps)
|
def materialize(deps)
|
||||||
materialized = self.for(deps, true)
|
materialized = self.for(deps, true)
|
||||||
|
|
||||||
SpecSet.new(materialized)
|
SpecSet.new(materialized, incomplete_specs)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Materialize for all the specs in the spec set, regardless of what platform they're for
|
# Materialize for all the specs in the spec set, regardless of what platform they're for
|
||||||
@ -100,19 +103,17 @@ module Bundler
|
|||||||
def incomplete_ruby_specs?(deps)
|
def incomplete_ruby_specs?(deps)
|
||||||
return false if @specs.empty?
|
return false if @specs.empty?
|
||||||
|
|
||||||
materialized = self.for(deps, true, [Gem::Platform::RUBY])
|
@incomplete_specs = []
|
||||||
|
|
||||||
SpecSet.new(materialized).incomplete_specs.any?
|
self.for(deps, true, [Gem::Platform::RUBY])
|
||||||
|
|
||||||
|
@incomplete_specs.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def missing_specs
|
def missing_specs
|
||||||
@specs.select {|s| s.is_a?(LazySpecification) }
|
@specs.select {|s| s.is_a?(LazySpecification) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def incomplete_specs
|
|
||||||
@specs.select {|s| s.is_a?(IncompleteSpecification) }
|
|
||||||
end
|
|
||||||
|
|
||||||
def merge(set)
|
def merge(set)
|
||||||
arr = sorted.dup
|
arr = sorted.dup
|
||||||
set.each do |set_spec|
|
set.each do |set_spec|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user