-
Notifications
You must be signed in to change notification settings - Fork 19
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
Skip using the extension for truffleruby as well #39
Conversation
Thank you! I think we should skip building the C extension as well given it won't be used in https://github.com/ruby/erb/blob/master/ext/erb/escape/extconf.rb, using something like in mini_racer: |
fixed it with |
This reverts commit acc1e0c.
lib/erb/util.rb
Outdated
@@ -5,9 +5,9 @@ | |||
# Rails will not monkey-patch ERB::Escape#html_escape. | |||
begin | |||
require 'erb/escape' | |||
rescue LoadError # JRuby can't load .so | |||
rescue LoadError # for JRuby, TruffleRuby |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Skipping the require entirely if TruffleRuby or JRuby seems nicer, because that avoids the extra LoadError, which notably causes eager RubyGems loading on TruffleRuby.
$LOAD_PATH.resolve_feature_path might be another way but seems more complicated and might not be available in older Ruby versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can make a PR with that as an optimization later, the current PR seems fine behavior-wise
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed 769ceb8. Ruby 3.1-compatible resolve_feature_path
could optimize away the LoadError now.
636b456
to
769ceb8
Compare
(ruby/erb#39) * Skip using the extension for truffleruby as well * Just skip building the C extension for TruffleRuby * Skip rake compile for truffleruby * Use resolve_feature_path * Revert "Use resolve_feature_path" This reverts commit ruby/erb@acc1e0c0ffaf. * Use resolve_feature_path with LoadError guard ruby/erb@85dcb08439
ref: https://twitter.com/eregontp/status/1596493699160367104