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

Skip using the extension for truffleruby as well #39

Merged
merged 6 commits into from
Nov 27, 2022

Conversation

k0kubun
Copy link
Member

@k0kubun k0kubun commented Nov 26, 2022

@k0kubun k0kubun requested a review from eregon November 26, 2022 21:53
@eregon
Copy link
Member

eregon commented Nov 27, 2022

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:
https://github.com/rubyjs/mini_racer/blob/master/ext/mini_racer_extension/extconf.rb

@k0kubun
Copy link
Member Author

k0kubun commented Nov 27, 2022

fixed it with dummy_makefile. It seems working on CI.

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
Copy link
Member

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.

Copy link
Member

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

Copy link
Member Author

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.

@k0kubun k0kubun force-pushed the truffleruby-skip-ext branch from 636b456 to 769ceb8 Compare November 27, 2022 06:27
@k0kubun k0kubun merged commit 85dcb08 into ruby:master Nov 27, 2022
@k0kubun k0kubun deleted the truffleruby-skip-ext branch November 27, 2022 06:30
matzbot pushed a commit to ruby/ruby that referenced this pull request Nov 27, 2022
(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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants