[rubygems/rubygems] Split finding and removing invalid platforms

I don't like traversing the array and modifying it at the same time
while it seems to work.

https://github.com/rubygems/rubygems/commit/6551c74c27
This commit is contained in:
David Rodríguez 2025-03-24 17:19:09 +01:00 committed by Hiroshi SHIBATA
parent f8720b01d9
commit 91df1795c5
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -1137,16 +1137,17 @@ module Bundler
def remove_invalid_platforms!
return if Bundler.frozen_bundle?
platforms.reverse_each do |platform|
invalid_platforms = platforms.select do |platform|
next if local_platform == platform ||
@new_platforms.include?(platform) ||
@path_changes ||
@dependency_changes ||
@locked_spec_with_invalid_deps ||
!spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
@locked_spec_with_invalid_deps
remove_platform(platform)
spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
end
@platforms -= invalid_platforms
end
def spec_set_incomplete_for_platform?(spec_set, platform)