Uh oh!
There was an error while loading. Please reload this page.
Import JRuby's strscan - #25
Conversation
kou
commented
Sep 3, 2021
The current CI failures are fixed by 3ceafa6. And do you have a plan to add jobs for JRuby to the current CI? |
headius
commented
Sep 7, 2021
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. |
headius
commented
Sep 7, 2021
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. |
headius
commented
Sep 7, 2021
Silly me... I forgot that @knawrocke contributed the original code over email 15 years ago, so I added him to the list. |
knawrocke
commented
Sep 7, 2021
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
nicksieger
commented
Sep 7, 2021
Ohai 👋 ! I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
headius
commented
Sep 7, 2021
Added @olabini / @olabiniV2 just to cover everyone who touched this code. |
enebo
commented
Sep 7, 2021
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
olabiniV2
commented
Sep 7, 2021
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. |
lopex
commented
Sep 8, 2021
I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
headius
commented
Feb 7, 2022
kares
commented
Feb 9, 2022
👍 for the effort and I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license. |
headius
commented
Apr 13, 2022
nahi
commented
Apr 13, 2022
I didn't know I did something for the file. Long history... |
vvs
commented
Apr 14, 2022
Hi there, fellas, long time no see! "I consent to having my contributions relicensed under the Ruby license and the BSD 2-clause license." |
headius
commented
Apr 14, 2022
kou
commented
Apr 15, 2022
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? |
headius
commented
Apr 15, 2022
@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. |
headius
commented
Apr 15, 2022
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? |
headius
commented
Apr 15, 2022
jruby/jruby#7177 filed for the Windows error message encoding failure. |
kou
commented
Apr 15, 2022
OK. |
headius
commented
Apr 18, 2022
@kou Can we get a preview gem for this one too please? |
kou
commented
Apr 19, 2022
Sure! |
headius
commented
Apr 19, 2022
I have updated JRuby master to use the strscan gem! That change will get picked up in the next nightly snapshot. |
kou
commented
Apr 19, 2022
Thanks! |
kou
commented
Apr 21, 2022
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.
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.
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.
* 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.
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.
I think RUBY_ENGINE should be enough. It has been available for a long time.
* 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. Fixestruffleruby/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:
javagem