Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support warning feature for bundled gems with bootsnap and zeitwerk #10347

Merged
merged 5 commits into from Mar 25, 2024

Conversation

hsbt
Copy link
Member

@hsbt hsbt commented Mar 25, 2024

I added some fixes from #10244

@hsbt
Copy link
Member Author

hsbt commented Mar 25, 2024

@fxn @byroot This version warn correctly with Zeitwerk and Bootsnap

* Show warning with bootsnap
/Users/hsbt/.local/share/gem/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30: warning: /Users/hsbt/.local/share/rbenv/versions/3.3.0-dev/lib/ruby/3.3.0/csv.rb was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec.

* Show warning with zeitwerk
/Users/hsbt/.local/share/gem/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34: warning: csv was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add csv to your Gemfile or gemspec.

@hsbt hsbt merged commit 990e11b into ruby:master Mar 25, 2024
98 checks passed
@hsbt hsbt deleted the support-zeitwerk branch March 25, 2024 05:33
hsbt added a commit to hsbt/ruby that referenced this pull request Mar 25, 2024
Fix incorrect warning target with Zeitwerk and support warning with Bootsnap.
casperisfine pushed a commit to Shopify/ruby that referenced this pull request Mar 25, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
@fxn
Copy link
Contributor

fxn commented Mar 25, 2024

Thanks @hsbt!

hsbt pushed a commit that referenced this pull request Mar 25, 2024
Followup: #10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
hsbt pushed a commit to hsbt/ruby that referenced this pull request Mar 25, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
github-merge-queue bot pushed a commit that referenced this pull request Mar 25, 2024
Fix incorrect warning target with Zeitwerk and support warning with Bootsnap.
hsbt pushed a commit to hsbt/ruby that referenced this pull request Mar 25, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
hsbt pushed a commit to hsbt/ruby that referenced this pull request Apr 16, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
jhawthorn added a commit to github/ruby that referenced this pull request Apr 23, 2024
@mscrivo
Copy link

mscrivo commented Apr 23, 2024

FYI, I'm not sure this is totally working as intended. We're using bootsnap and previously had no issues with 3.3.0, but upon updating to 3.3.1, now seeing this:

/Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:130:in `<': comparison of String with nil failed (ArgumentError)

    msg = " #{RUBY_VERSION < SINCE[gem] ? "will no longer be" : "is not"} part of the default gems since Ruby #{SINCE[gem]}."
                             ^^^^^^^^^^
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:130:in `build_message'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:126:in `warning?'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:71:in `block (2 levels) in replace_require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/logging-2.3.1/lib/logging.rb:10:in `<main>'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/mscrivo/.local/share/mise/installs/ruby/3.3.1/lib/ruby/gems/3.3.0/gems/zeitwerk-2.6.13/lib/zeitwerk/kernel.rb:34:in `require'

@hsbt
Copy link
Member Author

hsbt commented Apr 24, 2024

@mscrivo This change is not backport to 3.3.1 yet. Sorry, I confused with #10354

@hsbt
Copy link
Member Author

hsbt commented Apr 24, 2024

@mscrivo Can you file your Gemfile and environment to https://bugs.ruby-lang.org/issues/20450?

artur-intech pushed a commit to artur-intech/ruby that referenced this pull request Apr 26, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
hsbt pushed a commit to hsbt/ruby that referenced this pull request Apr 30, 2024
Followup: ruby#10347

This avoid directly referencing bootsnap and zeitwerk, and also
handle other gems that may decorate `require`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants