ruby-changes:72786
From: David <ko1@a...>
Date: Tue, 2 Aug 2022 16:10:46 +0900 (JST)
Subject: [ruby-changes:72786] 9189c2d5ef (master): [rubygems/rubygems] Materializing for resolution already filters platforms
https://git.ruby-lang.org/ruby.git/commit/?id=9189c2d5ef From 9189c2d5efa94131050df4994c801fb187d7b43d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Fri, 29 Jul 2022 22:09:51 +0200 Subject: [rubygems/rubygems] Materializing for resolution already filters platforms https://github.com/rubygems/rubygems/commit/9f4ba9ebb0 --- lib/bundler/lazy_specification.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/bundler/lazy_specification.rb b/lib/bundler/lazy_specification.rb index 05925e3e79..805afba51f 100644 --- a/lib/bundler/lazy_specification.rb +++ b/lib/bundler/lazy_specification.rb @@ -78,24 +78,29 @@ module Bundler https://github.com/ruby/ruby/blob/trunk/lib/bundler/lazy_specification.rb#L78 def materialize_for_installation source.local! - __materialize__(ruby_platform_materializes_to_ruby_platform? ? platform : Bundler.local_platform) + 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 + + source.specs.search(Dependency.new(name, version)).select do |spec| + MatchPlatform.platforms_match?(spec.platform, target_platform) + end + else + source.specs.search(self) + end + + __materialize__(candidates) end def materialize_for_resolution return self unless Gem::Platform.match_spec?(self) - __materialize__(platform) + candidates = source.specs.search(self) + + __materialize__(candidates) end - def __materialize__(platform) + def __materialize__(candidates) @specification = begin - candidates = if source.is_a?(Source::Path) || !ruby_platform_materializes_to_ruby_platform? - source.specs.search(Dependency.new(name, version)).select do |spec| - MatchPlatform.platforms_match?(spec.platform, platform) - end - else - source.specs.search(self) - end search = candidates.reverse.find do |spec| spec.is_a?(StubSpecification) || (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) && -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/