@@ -94,7 +94,7 @@ def initialize(lockfile, dependencies, sources, unlock, ruby_version = nil, opti
9494
9595 @locked_ruby_version = nil
9696 @new_platforms = [ ]
97- @removed_platform = nil
97+ @removed_platforms = [ ]
9898
9999 if lockfile_exists?
100100 @lockfile_contents = Bundler . read_file ( lockfile )
@@ -330,7 +330,7 @@ def resolve
330330 SpecSet . new ( filter_specs ( @locked_specs , @dependencies - deleted_deps ) )
331331 else
332332 Bundler . ui . debug "Found no changes, using resolution from the lockfile"
333- if @removed_platform || @locked_gems . may_include_redundant_platform_specific_gems?
333+ if @removed_platforms . any? || @locked_gems . may_include_redundant_platform_specific_gems?
334334 SpecSet . new ( filter_specs ( @locked_specs , @dependencies ) )
335335 else
336336 @locked_specs
@@ -416,10 +416,8 @@ def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
416416 deleted = [ ]
417417 changed = [ ]
418418
419- new_platforms = @platforms - @locked_platforms
420- deleted_platforms = @locked_platforms - @platforms
421- added . concat new_platforms . map { |p | "* platform: #{ p } " }
422- deleted . concat deleted_platforms . map { |p | "* platform: #{ p } " }
419+ added . concat @new_platforms . map { |p | "* platform: #{ p } " }
420+ deleted . concat @removed_platforms . map { |p | "* platform: #{ p } " }
423421
424422 added . concat new_deps . map { |d | "* #{ pretty_dep ( d ) } " } if new_deps . any?
425423 deleted . concat deleted_deps . map { |d | "* #{ pretty_dep ( d ) } " } if deleted_deps . any?
@@ -511,10 +509,10 @@ def add_platform(platform)
511509 end
512510
513511 def remove_platform ( platform )
514- removed_platform = @platforms . delete ( Gem :: Platform . new ( platform ) )
515- @removed_platform ||= removed_platform
516- return if removed_platform
517- raise InvalidOption , "Unable to remove the platform ` #{ platform } ` since the only platforms are #{ @platforms . join ", " } "
512+ raise InvalidOption , "Unable to remove the platform ` #{ platform } ` since the only platforms are #{ @platforms . join ", " } " unless @platforms . include? ( platform )
513+
514+ @removed_platforms << platform
515+ @platforms . delete ( platform )
518516 end
519517
520518 def nothing_changed?
0 commit comments