ruby/lib/rubygems/ext
David Rodríguez 8e5fe13c08 [rubygems/rubygems] Delay fileutils loading to fix some warnings
If the following conditions are met:

* You have a default version of fileutils and a higher version of
fileutils installed as a regular gem. This case is common on ruby 2.6.

* You use a bundler generated binstub on a gem setup with a `Gemfile`
using the `gemspec` DSL.

Then `fileutils` redefinition warnings happen because of the following:

The gist of a bundler generated binstub is:

```ruby
require "bundler/setup"
load Gem.bin_path("rake", "rake")
```

First configure bundler, then load the requested gem.

When `require "bundler/setup"` is called under the previously mentioned
setup, `ext_conf_builder.rb` ends up being required because of the new
validation that gemspecs with rake extensions depend on `rake`. And that
loads the latest version of `fileutils` because of using "rubygems
monkeypatched require" that auto-chooses the latest version of default
gems.

After that, when `Gem.bin_path` gets called, `ext_conf_builder.rb` gets
required again, but this time already using "bundler's unmonkeypatched
require" which means the default version is chosen and thus the
redefinition warning happens.

The solution as usual is to lazily load `fileutils`.

08d64e5f06
2020-06-05 07:32:42 +09:00
..
build_error.rb Merge master branch from rubygems/rubygems upstream. 2018-11-21 10:20:47 +00:00
builder.rb Sync rubygems with current master (#2889) 2020-03-24 15:39:24 +09:00
cmake_builder.rb Merge RubyGems master@9be7858f7f17eae3058204f3c03e4b798ba18b9c 2019-02-14 12:59:03 +00:00
configure_builder.rb Merge master branch from rubygems/rubygems upstream. 2018-11-21 10:20:47 +00:00
ext_conf_builder.rb [rubygems/rubygems] Delay fileutils loading to fix some warnings 2020-06-05 07:32:42 +09:00
rake_builder.rb Merge rubygems master from upstream. 2019-06-01 13:50:41 +03:00