[rubygems/rubygems] Upstream RubyGems changes from TruffleRuby
https://github.com/rubygems/rubygems/commit/749a508968
This commit is contained in:
parent
365c6cc226
commit
a94a2eea34
@ -1337,6 +1337,17 @@ begin
|
|||||||
rescue LoadError
|
rescue LoadError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TruffleRuby >= 24 defines REUSE_AS_BINARY_ON_TRUFFLERUBY in defaults/truffleruby.
|
||||||
|
# However, TruffleRuby < 24 defines REUSE_AS_BINARY_ON_TRUFFLERUBY directly in its copy
|
||||||
|
# of lib/rubygems/platform.rb, so it is not defined if RubyGems is updated (gem update --system).
|
||||||
|
# Instead, we define it here in that case, similar to bundler/lib/bundler/rubygems_ext.rb.
|
||||||
|
# We must define it here and not in platform.rb because platform.rb is loaded before defaults/truffleruby.
|
||||||
|
class Gem::Platform
|
||||||
|
if RUBY_ENGINE == "truffleruby" && !defined?(REUSE_AS_BINARY_ON_TRUFFLERUBY)
|
||||||
|
REUSE_AS_BINARY_ON_TRUFFLERUBY = %w[libv8 libv8-node sorbet-static].freeze
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Loads the default specs.
|
# Loads the default specs.
|
||||||
Gem::Specification.load_defaults
|
Gem::Specification.load_defaults
|
||||||
|
@ -43,11 +43,21 @@ class Gem::Platform
|
|||||||
match_gem?(spec.platform, spec.name)
|
match_gem?(spec.platform, spec.name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if RUBY_ENGINE == "truffleruby"
|
||||||
def self.match_gem?(platform, gem_name)
|
def self.match_gem?(platform, gem_name)
|
||||||
# NOTE: this method might be redefined by Ruby implementations to
|
raise "Not a string: #{gem_name.inspect}" unless String === gem_name
|
||||||
# customize behavior per RUBY_ENGINE, gem_name or other criteria.
|
|
||||||
|
if REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(gem_name)
|
||||||
|
match_platforms?(platform, [Gem::Platform::RUBY, Gem::Platform.local])
|
||||||
|
else
|
||||||
match_platforms?(platform, Gem.platforms)
|
match_platforms?(platform, Gem.platforms)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
def self.match_gem?(platform, gem_name)
|
||||||
|
match_platforms?(platform, Gem.platforms)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def self.sort_priority(platform)
|
def self.sort_priority(platform)
|
||||||
platform == Gem::Platform::RUBY ? -1 : 1
|
platform == Gem::Platform::RUBY ? -1 : 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user