summaryrefslogtreecommitdiff
path: root/lib/bundled_gems.rb
AgeCommit message (Collapse)Author
2024-09-16[Bug #20737] Do not warn default gems to be promoted in Ruby 3.5 (#11613)Hiroshi SHIBATA
2024-08-21Backport warning feature for bundled gems from master (#11420)Hiroshi SHIBATA
* Make sure to always use the right `warn` * lib/bundled_gems.rb: more reliable caller detection The `2` skipped frames went out of sync and now it should be `3`. Rather than just update the offset, we can implement a way that is adaptative as long as all require decorators are also called require. Also we should compute the corresponding `uplevel` otherwise the warning will still point decorators. Co-authored-by: "Hiroshi SHIBATA" <hsbt@ruby-lang.org> * Warn ostruct for Ruby 3.5 * Warn pstore for Ruby 3.5 * Mark rdoc as bundled gems at Ruby 3.5 * Warn to use win32ole without Gemfile for Ruby 3.5 * EXACT list is mostly same as SINCE list on bundled gems. * Mark to warn fiddle as bundled gems for Ruby 3.5 * Mark to warn logger as bundled gems for Ruby 3.5 * We should use uplevel:2 in another case. Like the following scenario with bootsnap, that frames are same or smaller than frame_to_skip(=3). --- "/Users/hsbt/.local/share/rbenv/versions/3.3-dev/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'" "/Users/hsbt/.local/share/gem/gems/bootsnap-1.18.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'" "test_warn_bootsnap.rb:11:in `<main>'" --- * Delete unnecessary rubocop disable comment * Show correct script name with sub-feature case * Skip to show script name with using ruby -r option * Don't show script name when bundle exec and call ruby script directly. * Pick word fix from 34adc07372c10170b8ca36111d216cbd8e4699be --------- Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net> Co-authored-by: Jean Boussier <jean.boussier@gmail.com> Co-authored-by: Kentaro Takeyama <75117116+obregonia1@users.noreply.github.com>
2024-07-22bundled_gems.rb: Add a fast path (#11221)Jean byroot Boussier
bundled_gems.rb: Add a fast path [Bug #20641] `Gem::BUNDLED_GEMS.warning?` adds a lot of extra work on top of `require`. When the call end up atually loading code the overhead is somewhat marginal. However it's not uncommon for code to go some late `require` in some paths, so it's expected that calling `require` with something already required is somewhat fast, and `bundled_gems.rb` breaks this assumption. To avoid this, we can have a fast path that in most case allow to short-circuit all the heavy computations. If we extract the feature basename and it doesn't match any of the bundled gems we care about we can return very early. With this change `require 'date'` is now only 1.33x slower on Ruby 3.3.3, than it was on Ruby 3.2.2, whereas before this change it was at least 100x slower. Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-05-28[Bug #20450] Remove rubyarchdir from bootsnap pathsEugene Kenny
2024-05-28Fix error when default gem is loaded from `-r` optionMasataka Pocke Kuwabara
This patch fixes an error when a default gem that will be migrated to a bundled gem is loaded from `-r` option. Problem === `bundle exec ruby -rostruct -e ''` unexpectedly raises the following error: ```console $ ruby -v ruby 3.4.0dev (2024-04-08T02:39:00Z master 6f7e8e278f) [arm64-darwin21] $ bundle init && bundle install $ bundle exec ruby -rostruct -e '' /Users/kuwabara.masataka/.rbenv/versions/trunk/lib/ruby/3.4.0+0/bundled_gems.rb:111:in 'Gem::BUNDLED_GEMS.warning?': undefined method 'find' for nil (NoMethodError) caller = caller_locations(3, 3).find {|c| c&.absolute_path} ^^^^^ from /Users/kuwabara.masataka/.rbenv/versions/trunk/lib/ruby/3.4.0+0/bundled_gems.rb:75:in 'block (2 levels) in Kernel#replace_require' ``` Solution === This patch uses a safe navigation operator to fix this problem. By this change, the command will show the warning message correctly. ```console $ bundle exec ruby -rostruct -e '' warning: ostruct was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0. Add ostruct to your Gemfile or gemspec. ```
2024-05-28Ignore warnings on the bundled gems repoHiroshi SHIBATA
2024-05-28lib/bundled_gems.rb: dynamically ignore Kernel.require decoratorsJean Boussier
Followup: https://github.com/ruby/ruby/pull/10347 This avoid directly referencing bootsnap and zeitwerk, and also handle other gems that may decorate `require`.
2024-03-25Backport https://github.com/ruby/ruby/pull/10347 (#10349)Hiroshi SHIBATA
Fix incorrect warning target with Zeitwerk and support warning with Bootsnap.
2024-02-01Backport bundled_gems.rb for Ruby 3.3 (#9457)Hiroshi SHIBATA
racc is extracted at Ruby 3.3, not 3.4
2023-12-19[DOC] No ducuments for internal libraryNobuyoshi Nakada
2023-12-16Avoid warning when requiring bigdecimal/util when bigdecimal is in gemfileSamuel Giddins
2023-12-15Revert "[Bug #20060] Properly return matched gem name in case of EXACT"Hiroshi SHIBATA
This reverts commit 75c40802cb06d83fc2c3d0eca6d904fa41307230. This change is now working correctly with warning cases.
2023-12-15Fix gem detection for names with dashDavid Rodríguez
2023-12-14Detect bootsnap from all framesHiroshi SHIBATA
2023-12-14Skip warning feature with BootsnapHiroshi SHIBATA
Bootsnap modified full feature path to require. We can't handle it for warning correctly.
2023-12-14[Bug #20060] Properly return matched gem name in case of EXACTAkira Matsuda
this follows up 4e6861d3376eb7857d2b0a947c97b6fec8e5bf37
2023-12-13We need only one line for detecting caller gem nameHiroshi SHIBATA
2023-12-08Revert "Skip to warn like 'bigdecimal/util' feature."Hiroshi SHIBATA
This reverts commit 8f6cf72e661e36410848c1451335fd28a32cecdf.
2023-12-08Skip to warn like 'bigdecimal/util' feature.Hiroshi SHIBATA
2023-12-08Improve bundled gems warnings for subfeaturesDavid Rodríguez
Before, when requiring "bigdecimal/math" in a Bundler context: > /Users/deivid/.asdf/installs/ruby/3.3.0-dev/lib/ruby/3.3.0+0/bigdecimal/math.rb:2: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. After: > foo.rb:1: warning: bigdecimal/math is found in bigdecimal, which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
2023-12-08Improve bundled gem warningsDavid Rodríguez
Before, when requiring "bigdecimal" in a Bundler context: > foo.rb:1: warning: bigdecimal which will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. After: > foo.rb:1: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec.
2023-12-08The SINCE and WARNED hashes take gem names, not featuresDavid Rodríguez
2023-12-07Move replace_require into bundled_gems.rbHiroshi SHIBATA
2023-11-16Warn bundled gems before Ruby 3.4.0Hiroshi SHIBATA
2023-11-02Surpressing additional message if it missed to detect gem nameHiroshi SHIBATA
2023-11-02Fix to detect gem name logic. It's mistake to migrate bundled_gems.rb from ↵Hiroshi SHIBATA
rubygems_integration.rb https://github.com/ioquatix/bake/pull/15#issuecomment-1777985097
2023-11-02Support Pathname object for warning feature of bundled gemsHiroshi SHIBATA
2023-10-20Sort gem namesHiroshi SHIBATA
2023-10-20racc is also extracted to bundled gemsHiroshi SHIBATA
2023-10-18Tweak the grammarHiroshi SHIBATA
2023-10-18normalize gem name without .so or .bundleHiroshi SHIBATA
2023-10-18reject bundled gems if they are declared in GemfileHiroshi SHIBATA
2023-10-13Ignore duplicated warning with native extensionHiroshi SHIBATA
2023-10-13Fix wrong gem nameHiroshi SHIBATA
2023-10-13Ignore warning on LoadError when running under BundlerHiroshi SHIBATA
2023-10-13Added recovery instructions for RubyGemsHiroshi SHIBATA
2023-10-13Surpressing double warningsHiroshi SHIBATA
2023-10-13Warn only LoadError without Bundler environmentHiroshi SHIBATA
2023-10-13Move additional warnings for Gem author under Gem::BUNDLED_GEMS.Hiroshi SHIBATA
2023-10-13Move path normalization into Gem from Bundler classHiroshi SHIBATA
2023-08-26[Bug #19852] Use gem name without suffixNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8295
2023-08-25Warn for bigdecimal.so case tooHiroshi SHIBATA
2023-08-25prime is bundled gems since Ruby 3.1.0. We should warn it under the bundler ↵Hiroshi SHIBATA
environment
2023-08-25We should also warn when loading 'bigdecimal/*' librariesHiroshi SHIBATA
2023-08-25Decorate Hash syntax for Gem::BUNDLED_GEMS::EXACTHiroshi SHIBATA
2023-08-22Added bigdecimal to warning targets for the bundled gems.Hiroshi SHIBATA
[Bug #19843]
2023-08-05Fix `Gem::BUNDLED_GEMS.find_gem` return valueNobuyoshi Nakada
If the required name is different from the found gem name, return the gem name, instead of true that means the required name is an exact gem name. Notes: Merged: https://github.com/ruby/ruby/pull/8178
2023-08-04Use future tense if current version is older than list versionHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/8172
2023-07-28Removed unnecessary methodsHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/8126
2023-07-28Warn default gems which will be gemified in futureNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/8126