summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2025-03-25 14:46:35 +0100
committerHiroshi SHIBATA <[email protected]>2025-03-31 09:39:22 +0900
commitdea505dea014c45062fb2963d4eb770be1497a4a (patch)
treef60014bd2dc412567690bea0dbb358c46964c914 /lib/bundler
parentb2bcd360441c334f16148908684e9b409eac4949 (diff)
[rubygems/rubygems] Allow ruby platform to be remove also when dependencies have changed
Since we will now add it back if the final resolution is compatible, we can also get this kind of edge case (`bundle add`) working. https://github.com/rubygems/rubygems/commit/cdc5ebec77
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/definition.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index d57a9704d8..f0d7cf8d2a 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -1144,8 +1144,14 @@ module Bundler
@originally_invalid_platforms = platforms.select do |platform|
next if local_platform == platform ||
- @new_platforms.include?(platform) ||
- @dependency_changes
+ @new_platforms.include?(platform)
+
+ # We should probably avoid removing non-ruby platforms, since that means
+ # lockfile will no longer install on those platforms, so a error to give
+ # heads up to the user may be better. However, we have tests expecting
+ # non ruby platform autoremoval to work, so leaving that in place for
+ # now.
+ next if @dependency_changes && platform != Gem::Platform::RUBY
spec_set_incomplete_for_platform?(@originally_locked_specs, platform)
end