Skip to content

Commit 8f922d9

Browse files
Fix incorrect force_ruby_platform propagation
It was just working by chance. (cherry picked from commit 16b2d6b)
1 parent 2777e79 commit 8f922d9

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

bundler/lib/bundler/rubygems_ext.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ class Dependency
155155

156156
alias_method :eql?, :==
157157

158+
def force_ruby_platform
159+
false
160+
end
161+
158162
def encode_with(coder)
159163
to_yaml_properties.each do |ivar|
160164
coder[ivar.to_s.sub(/^@/, "")] = instance_variable_get(ivar)

bundler/lib/bundler/spec_set.rb

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,27 @@ def initialize(specs)
1313

1414
def for(dependencies, check = false, platforms = [nil])
1515
handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
16-
deps = dependencies.product(platforms).map {|dep, platform| [dep.name, platform && dep.force_ruby_platform ? Gem::Platform::RUBY : platform] }
16+
deps = dependencies.product(platforms)
1717
specs = []
1818

1919
loop do
2020
break unless dep = deps.shift
21-
next if handled.key?(dep)
2221

23-
handled[dep] = true
22+
key = [dep[0].name, dep[1]]
23+
next if handled.key?(key)
24+
25+
handled[key] = true
2426

2527
specs_for_dep = specs_for_dependency(*dep)
2628
if specs_for_dep.any?
2729
specs.concat(specs_for_dep)
2830

2931
specs_for_dep.first.dependencies.each do |d|
3032
next if d.type == :development
31-
deps << [d.name, dep[1]]
33+
deps << [d, dep[1]]
3234
end
3335
elsif check
34-
specs << IncompleteSpecification.new(*dep)
36+
specs << IncompleteSpecification.new(*key)
3537
end
3638
end
3739

@@ -175,13 +177,12 @@ def tsort_each_node
175177
@specs.sort_by(&:name).each {|s| yield s }
176178
end
177179

178-
def specs_for_dependency(name, platform)
179-
specs_for_name = lookup[name]
180+
def specs_for_dependency(dep, platform)
181+
specs_for_name = lookup[dep.name]
180182
if platform.nil?
181183
GemHelpers.select_best_platform_match(specs_for_name.select {|s| Gem::Platform.match_spec?(s) }, Bundler.local_platform)
182184
else
183-
specs_for_name_and_platform = GemHelpers.select_best_platform_match(specs_for_name, platform)
184-
specs_for_name_and_platform.any? ? specs_for_name_and_platform : specs_for_name
185+
GemHelpers.select_best_platform_match(specs_for_name, dep.force_ruby_platform ? Gem::Platform::RUBY : platform)
185186
end
186187
end
187188

0 commit comments

Comments
 (0)