-
Notifications
You must be signed in to change notification settings - Fork 32
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
Import JRuby's strscan #25
Conversation
The current CI failures are fixed by 3ceafa6. And do you have a plan to add jobs for JRuby to the current CI? |
Thank you, yes I will rebase!
That is the primary reason this is a draft. We need to get all the tests green and then I will push a CI job for JRuby. |
Also needs some tweaks to get a -java gem released. I will add a checklist to the PR description. |
I have reviewed the current code and we would need confirmation from the following individuals to relicense. Contributors listed below: please respond in a comment with the following, assuming you consent: "I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license." For me: I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
Silly me... I forgot that @knawrocke contributed the original code over email 15 years ago, so I added him to the list. |
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
Ohai 👋 ! I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
Added @olabini / @olabiniV2 just to cover everyone who touched this code. |
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
Hi everyone. I am Ola Bini - the owner of the @olabini account - which I'm currently locked out of. If any legal issues arise, I'm willing to provide offline government identification if necessary, to support this agreement. I consent to my contributions being relicensed under the Ruby license and the BSD 2-clause license. |
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
👍 for the effort and I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
I didn't know I did something for the file. Long history... |
Hi there, fellas, long time no see! "I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license." |
Great!!! @headius Could you confirm the test failure only on Windows + JRuby?
Note: Is it a test problem? Or is it a JRuby on Windows problem? |
@kou I believe this is a problem specific to Windows, and only affects the error message here (the error is still raised, but due to Windows + Java exception logic and character encoding, the message is encoded incorrectly). I can open a JRuby issue to fix that but it will not be in a release for a little while. We could skip that test for now, or simplify it for JRuby. |
I should also point out that this is the last test in test_AREF, and we pass everything else there. Perhaps the error message is not critical enough to block JRuby? |
jruby/jruby#7177 filed for the Windows error message encoding failure. |
OK. |
@kou Can we get a preview gem for this one too please? |
Sure! |
I have updated JRuby master to use the strscan gem! That change will get picked up in the next nightly snapshot. |
Thanks! |
CI sill works except jruby/jruby#7177 : https://github.com/ruby/strscan/actions/runs/2186790823 |
if RUBY_ENGINE == 'jruby' | ||
require 'strscan.jar' | ||
JRuby::Util.load_ext("org.jruby.ext.strscan.StringScannerLibrary") | ||
else | ||
require 'strscan.so' | ||
end |
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.
This is actually unfortunate, because it would just work on TruffleRuby otherwise, since the strscan.rb
in stdlib would win over strscan.so
.
Yet another reason for JRuby to support require 'strscan'
to load the strscan.jar
+ the necessary setup.
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.
Specifically, this causes:
bundle exec rake test
/home/eregon/.rubies/truffleruby-dev/bin/truffleruby run-test.rb
<internal:core> core/kernel.rb:236:in `gem_original_require': cannot load such file -- strscan.so (LoadError)
Did you mean? strscan
from /home/eregon/code/strscan/lib/strscan.rb:5:in `<top (required)>'
from <internal:core> core/kernel.rb:234:in `gem_original_require'
from /home/eregon/code/strscan/test/strscan/test_stringscanner.rb:7:in `<top (required)>'
from <internal:core> core/kernel.rb:234:in `gem_original_require'
from run-test.rb:8:in `block in <main>'
from <internal:core> core/dir.rb:261:in `each'
from <internal:core> core/dir.rb:261:in `glob'
from run-test.rb:7:in `<main>'
rake aborted!
while tests ran fine before.
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.
#35 to fix it
* This is necessary since lib/strscan.rb was added (ruby#25), as the TruffleRuby stdlib strscan.rb is no longer found first by `require "strscan"`. * Write conditions in a way that any other Ruby implementation would simply use its stdlib until it is added explicit support in this gem.
* This is necessary since lib/strscan.rb was added (ruby#25), as the TruffleRuby stdlib strscan.rb is no longer found first by `require "strscan"`. * Write conditions in a way that any other Ruby implementation would simply use its stdlib until it is added explicit support in this gem.
s.files = %w{ext/strscan/extconf.rb ext/strscan/strscan.c} | ||
s.extensions = %w{ext/strscan/extconf.rb} | ||
|
||
jruby = true if Gem::Platform.new('java') =~ s.platform or RUBY_ENGINE == 'jruby' |
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.
Is this necessary or just RUBY_ENGINE == 'jruby'
would be enough?
(I noticed this line when modifying this file and wondering whether it can be simplified)
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.
@headius What do you think about this?
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 think RUBY_ENGINE should be enough. It has been available for a long time.
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.
* This is necessary since lib/strscan.rb was added (#25), as the TruffleRuby stdlib strscan.rb is no longer found first by `require "strscan"`. * Write conditions in a way that any other Ruby implementation would simply use its stdlib until it is added explicit support in this gem. Fixes oracle/truffleruby#2420 Co-authored-by: Sutou Kouhei <kou@clear-code.com>
Finally getting around to addressing #15. Initial import has gone well but there are a few failures to look into, probably just feature/fix drift in our implementation.
I will fix the issues and make sure this packages properly as a gem, so we can start using it in JRuby 9.4 (equivalent to CRuby 3.0).
TODO:
java
gem