Skip to content

Conversation

headius
Copy link
Contributor

@headius headius commented May 10, 2022

The strscan.rb file is only needed by JRuby, which does not have an extension file format that loads itself. As noted in #35 having this file present on TruffleRuby prevents their built-in strscan.rb from loading, so the file was moved to lib/jruby/strscan.rb with lib/jruby added as a require path. However this results in both lib/strscan.rb and lib/jruby/strscan.rb getting copied into JRuby's stdlib when the default gem is installed, leading to the confusing situation in #38.

This PR moves the jruby-specific strscan.rb under the jruby extension, renaming that directory to be explicitly for JRuby, and adding that new ext/jruby/lib path to the require paths so there's no nesting of require paths to copy files multiple times.

  • ext/java => ext/jruby
  • lib/jruby/strscan.rb => ext/jruby/lib/strscan.rb
  • Changes to Rakefile and gemspec for new locations

Fixes #38

* ext/java => ext/jruby
* lib/jruby/strscan.rb => ext/jruby/lib/strscan.rb
* Changes to Rakefile and gemspec for new locations

Fixes ruby#38
@headius headius force-pushed the jruby_strscan_move branch from 8071313 to 9d7d8aa Compare May 10, 2022 09:43
@eregon
Copy link
Member

eregon commented May 10, 2022

Looks good to me 👍

@headius
Copy link
Contributor Author

headius commented May 10, 2022

I believe this is ready. The only remaining failure is the known issue on Windows (which @enebo and I have discussed a bit... we are not encoding the error message correctly and will fix this later).

There's no urgent need to re-release with this change (nothing is actually broken right now), but it would be nice because Git shows me that there's an unversioned, unignored lib/ruby/stdlib/jruby/strscan.rb file that annoys me. 😀

@kou kou merged commit 5aaea6d into ruby:master May 10, 2022
@kou
Copy link
Member

kou commented May 10, 2022

Thanks!
Should we release a new version?

@headius
Copy link
Contributor Author

headius commented May 10, 2022

@kou That would be great, thank you!

@kou
Copy link
Member

kou commented May 10, 2022

Done!

headius added a commit to jruby/jruby that referenced this pull request May 11, 2022
Fixes extra strscan.rb in stdlib as reported in ruby/strscan#38
and fixed in ruby/strscan#39.
@headius headius deleted the jruby_strscan_move branch May 11, 2022 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strscan.rb move causes two copies in JRuby stdlib
3 participants