diff options
| author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2025-03-24 17:19:09 +0100 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2025-03-31 09:39:22 +0900 |
| commit | 91df1795c5bc9659ff7cec6c8f5a1b3eade1145b (patch) | |
| tree | e686b9b41846b7defaaff6a911cc8eb672093856 | |
| parent | f8720b01d9500d890a5b2a499c5126b83951c3cb (diff) | |
[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
| -rw-r--r-- | lib/bundler/definition.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb index a5ec2d64c7..491d4f11cb 100644 --- a/lib/bundler/definition.rb +++ b/lib/bundler/definition.rb @@ -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) |
