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
| begin | ||
| require 'erb/escape' | ||
| rescue LoadError # JRuby can't load .so | ||
| rescue LoadError # for JRuby, TruffleRuby |
There was a problem hiding this comment.
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.
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.
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