[rubygems/rubygems] Fix some JRuby warnings when using bundler/setup with Ruby's -w flag

When using the `bundler/setup` entrypoint, Bundler prints the following
warnings in JRuby in `-w` is passed to Ruby.

```
/path/to/bundler/shared_helpers.rb:10: warning: constant Bundler::WINDOWS is deprecated
/path/to/bundler/shared_helpers.rb:11: warning: constant Bundler::FREEBSD is deprecated
/path/to/bundler/lib/bundler/shared_helpers.rb:12: warning: constant Bundler::NULL is deprecated
```

This does not happen in CRuby.

This seems like a JRuby bug but we can skip it by autoloading the
constants.

https://github.com/rubygems/rubygems/commit/761ca29fa2
This commit is contained in:
David Rodríguez 2024-11-04 20:02:55 +01:00 committed by git
parent e5860e5654
commit 8c184885b0
2 changed files with 4 additions and 1 deletions

View File

@ -10,7 +10,6 @@ require_relative "bundler/plugin"
require_relative "bundler/rubygems_ext"
require_relative "bundler/rubygems_integration"
require_relative "bundler/version"
require_relative "bundler/constants"
require_relative "bundler/current_ruby"
require_relative "bundler/build_metadata"
@ -52,6 +51,7 @@ module Bundler
autoload :Env, File.expand_path("bundler/env", __dir__)
autoload :Fetcher, File.expand_path("bundler/fetcher", __dir__)
autoload :FeatureFlag, File.expand_path("bundler/feature_flag", __dir__)
autoload :FREEBSD, File.expand_path("bundler/constants", __dir__)
autoload :GemHelper, File.expand_path("bundler/gem_helper", __dir__)
autoload :GemHelpers, File.expand_path("bundler/gem_helpers", __dir__)
autoload :GemVersionPromoter, File.expand_path("bundler/gem_version_promoter", __dir__)
@ -62,6 +62,7 @@ module Bundler
autoload :LazySpecification, File.expand_path("bundler/lazy_specification", __dir__)
autoload :LockfileParser, File.expand_path("bundler/lockfile_parser", __dir__)
autoload :MatchRemoteMetadata, File.expand_path("bundler/match_remote_metadata", __dir__)
autoload :NULL, File.expand_path("bundler/constants", __dir__)
autoload :ProcessLock, File.expand_path("bundler/process_lock", __dir__)
autoload :RemoteSpecification, File.expand_path("bundler/remote_specification", __dir__)
autoload :Resolver, File.expand_path("bundler/resolver", __dir__)
@ -80,6 +81,7 @@ module Bundler
autoload :UI, File.expand_path("bundler/ui", __dir__)
autoload :URICredentialsFilter, File.expand_path("bundler/uri_credentials_filter", __dir__)
autoload :URINormalizer, File.expand_path("bundler/uri_normalizer", __dir__)
autoload :WINDOWS, File.expand_path("bundler/constants", __dir__)
autoload :SafeMarshal, File.expand_path("bundler/safe_marshal", __dir__)
class << self

View File

@ -74,6 +74,7 @@ RSpec.describe "bundle install across platforms" do
G
expect(the_bundle).to include_gems "platform_specific 1.0 ruby"
expect(err).to be_empty
end
context "on universal Rubies" do