Skip to content

Commit

Permalink
fix silently removing non-local-platform gems (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer authored Oct 5, 2023
1 parent 68891b2 commit 34c6f67
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/bundler/multilock.rb
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@ def write_lockfile(lockfile_definition, lockfile, install:, dependency_changes:
previous_ui_level = Bundler.ui.level
Bundler.ui.level = "warn"
begin
# this is a horrible hack, to fix what I consider to be a Bundler bug.
# basically, if you have multiple platform specific gems in your
# lockfile, and that gem gets unlocked, Bundler will only search
# locally to find them. But non-platform-local gems are _never_
# installed locally. So just find the non-platform-local gems
# in the lockfile (that we know are there from a prior remote
# resolution), and add them to the locally installed spec list.
definition.send(:source_map).locked_specs.each do |spec|
next if spec.match_platform(Bundler.local_platform)

spec.source.specs.add(spec)
end
definition.resolve_with_cache!
rescue GemNotFound, SolveFailure
definition = orig_definition
Expand Down

0 comments on commit 34c6f67

Please sign in to comment.