mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 05:25:34 +02:00

When resolving on truffleruby, and multiple platforms are included in the lockfile, Bundler will not respect existing platforms, but always force ruby variants. That means removal of existing version specific variants, introducing lockfile churn between implementations. To prevent this, we introduce the distinction between `Dependency#force_ruby_platform`, only settable via Gemfile, and `Dependency#default_force_ruby_platform`, which is always true on truffleruby for certain dependency names. This way, when resolving lockfile gems for other platforms on truffleruby, we keep platform specific variants in the lockfile. However, that introduces the problem that if only platform specific variants are locked in the lockfile, Bundler won't be able to materialize on truffleruby because the generic variant will be missing. To fix this additional problem, we make sure the generic "ruby" platform is always added when resolving on truffleruby.
16 lines
544 B
Ruby
16 lines
544 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Bundler
|
|
module ForcePlatform
|
|
# The `:force_ruby_platform` value used by dependencies for resolution, and
|
|
# by locked specifications for materialization is `false` by default, except
|
|
# for TruffleRuby. TruffleRuby generally needs to force the RUBY platform
|
|
# variant unless the name is explicitly allowlisted.
|
|
|
|
def default_force_ruby_platform
|
|
return false unless RUBY_ENGINE == "truffleruby"
|
|
|
|
!Gem::Platform::REUSE_AS_BINARY_ON_TRUFFLERUBY.include?(name)
|
|
end
|
|
end
|
|
end
|