summaryrefslogtreecommitdiff
path: root/lib/bundler/lazy_specification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/lazy_specification.rb')
-rw-r--r--lib/bundler/lazy_specification.rb21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb
index 7b1d28b0c3..1081910816 100644
--- a/lib/bundler/lazy_specification.rb
+++ b/lib/bundler/lazy_specification.rb
@@ -4,7 +4,7 @@ require_relative "match_platform"
module Bundler
class LazySpecification
- Identifier = Struct.new(:name, :version, :source, :platform, :dependencies)
+ Identifier = Struct.new(:name, :version, :platform)
class Identifier
include Comparable
def <=>(other)
@@ -108,7 +108,7 @@ module Bundler
end
def identifier
- @__identifier ||= Identifier.new(name, version, source, platform, dependencies)
+ @__identifier ||= Identifier.new(name, version, platform)
end
def git_version
@@ -131,17 +131,16 @@ module Bundler
end
#
- # Bundler 2.2.0 was the first version that records the full resolution
- # including platform specific gems in the lockfile, which means that if a
- # gem with RUBY platform is recorded, the RUBY platform version of the gem
- # should be installed. Previously bundler would record only generic versions
- # in the lockfile and then install the most specific platform variant if
- # available.
+ # For backwards compatibility with existing lockfiles, if the most specific
+ # locked platform is RUBY, we keep the previous behaviour of resolving the
+ # best platform variant at materiliazation time. For previous bundler
+ # versions (before 2.2.0) this was always the case (except when the lockfile
+ # only included non-ruby platforms), but we're also keeping this behaviour
+ # on newer bundlers unless users generate the lockfile from scratch or
+ # explicitly add a more specific platform.
#
def ruby_platform_materializes_to_ruby_platform?
- locked_bundler_version = Bundler.locked_bundler_version
-
- locked_bundler_version.nil? || Gem::Version.new(locked_bundler_version) >= Gem::Version.new("2.2.0")
+ !Bundler.most_specific_locked_platform?(Gem::Platform::RUBY)
end
end
end