Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/install-rubygems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,8 @@ jobs:
- name: Check we can install a Gemfile with git sources
run: bundle init && bundle add fileutils --git https://github.com/ruby/fileutils
shell: bash
- name: Generate a Rails application
run: gem install rails && rails new foo
shell: bash

timeout-minutes: 10
1 change: 0 additions & 1 deletion bundler/lib/bundler/gem_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ module GemHelpers
GENERIC_CACHE = { Gem::Platform::RUBY => Gem::Platform::RUBY } # rubocop:disable Style/MutableConstant
GENERICS = [
[Gem::Platform.new("java"), Gem::Platform.new("java")],
[Gem::Platform.new("universal-java"), Gem::Platform.new("java")],
[Gem::Platform.new("mswin32"), Gem::Platform.new("mswin32")],
[Gem::Platform.new("mswin64"), Gem::Platform.new("mswin64")],
[Gem::Platform.new("universal-mingw32"), Gem::Platform.new("universal-mingw32")],
Expand Down
9 changes: 6 additions & 3 deletions bundler/lib/bundler/lazy_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def materialize_for_installation
source.local!

candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform?
target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform
target_platform = ruby_platform_materializes_to_ruby_platform? ? platform : local_platform

source.specs.search(Dependency.new(name, version)).select do |spec|
MatchPlatform.platforms_match?(spec.platform, target_platform)
Expand Down Expand Up @@ -144,15 +144,18 @@ def method_missing(method, *args, &blk)

#
# For backwards compatibility with existing lockfiles, if the most specific
# locked platform is RUBY, we keep the previous behaviour of resolving the
# locked platform is not a specific platform like x86_64-linux or
# universal-java-11, then we keep the previous behaviour of resolving the
# best platform variant at materiliazation time. For previous bundler
# versions (before 2.2.0) this was always the case (except when the lockfile
# only included non-ruby platforms), but we're also keeping this behaviour
# on newer bundlers unless users generate the lockfile from scratch or
# explicitly add a more specific platform.
#
def ruby_platform_materializes_to_ruby_platform?
!Bundler.most_specific_locked_platform?(generic_local_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
generic_platform = generic_local_platform == Gem::Platform::JAVA ? Gem::Platform::JAVA : Gem::Platform::RUBY

!Bundler.most_specific_locked_platform?(generic_platform) || force_ruby_platform || Bundler.settings[:force_ruby_platform]
end
end
end
6 changes: 3 additions & 3 deletions bundler/lib/bundler/remote_specification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def fetch_platform
end

def identifier
@__identifier ||= [name, version, @original_platform.to_s]
@__identifier ||= [name, version, @platform.to_s]
end

def full_name
if @original_platform == Gem::Platform::RUBY
if @platform == Gem::Platform::RUBY
"#{@name}-#{@version}"
else
"#{@name}-#{@version}-#{@original_platform}"
"#{@name}-#{@version}-#{@platform}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion bundler/spec/bundler/remote_specification_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
let(:platform) { "jruby" }

it "should return the spec name, version, and platform" do
expect(subject.full_name).to eq("foo-1.0.0-jruby")
expect(subject.full_name).to eq("foo-1.0.0-java")
end
end
end
Expand Down