diff options
author | David RodrÃguez <[email protected]> | 2024-11-04 20:02:55 +0100 |
---|---|---|
committer | git <[email protected]> | 2024-11-06 11:37:10 +0000 |
commit | 8c184885b09d600b4c35fe04be3da0c9c5b36adf (patch) | |
tree | 84f9e3a487481cea15f8c5ab2f50010cfaff3d1c | |
parent | e5860e565467cb330f2c7b9ae140a1e4b89c0b71 (diff) |
[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
-rw-r--r-- | lib/bundler.rb | 4 | ||||
-rw-r--r-- | spec/bundler/install/gemfile/platform_spec.rb | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index 3cb1f076a0..cbe9eee89c 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -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 diff --git a/spec/bundler/install/gemfile/platform_spec.rb b/spec/bundler/install/gemfile/platform_spec.rb index 820feb18bf..1e536e6052 100644 --- a/spec/bundler/install/gemfile/platform_spec.rb +++ b/spec/bundler/install/gemfile/platform_spec.rb @@ -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 |