8000 Fixes to update Warbler to modern libs and JRuby by headius · Pull Request #559 · jruby/warbler · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixes to update Warbler to modern libs and JRuby #559

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

Merged
merged 32 commits into from
Jun 25, 2025

Conversation

headius
Copy link
Member
@headius headius commented Jun 20, 2025

This PR will encompass fixes to get Warbler updated for modern JRuby, modern Ruby, and modern versions of necessary libraries.

Fixes #558.

Safe mode is long dead, and other args should be in kwargs.

Fixes part of jruby#558
@headius
Copy link
Member Author
headius commented Jun 20, 2025

Fixes here will try to resolve #558.

headius added 4 commits June 20, 2025 13:26
This hack appears to have been added around the same time we
started to support bundling dependencies from source repos, and
may no longer be necessary. My reading of the code is that it was
done to work around a bug in bundler when loading itself from a
source repo. Removing this hack allows many more tests to pass on
JRuby 10 and Bundler 2.6.3.
@headius
Copy link
Member Author

I removed a hack by @nicksieger that apparently worked around some issues with gem specifications' "loaded from" attribute when loading bundler. The logic presented does not properly handle the case where the running bundler is a default gem (as it is in any recent release of JRuby) and I'm not sure if it's necessary anymore in any case.

@headius
Copy link
Member Author
headius commented Jun 20, 2025

jbundler-related failures are going to need an update to that library. I've started the process here: jruby/jbundler#104

cc @mkristian I need to move that repo over to jruby org and get push rights with you get a chance. Thank you!

@headius
Copy link
Member Author
headius commented Jun 20, 2025

maven-tools 1.2.3 has been released which included a few unreleased fixes. This eliminates some build failures due to it referencing the defunct torquebox gem proxy URL.

@headius
Copy link
Member Author
headius commented Jun 20, 2025

With an updated jbundler (only available as a local build) and maven-tools I have failures down to four:

  1) Warbler::Jar with Bundler in a war project with :git entries in the Gemfile works with :git entries in Gemfiles
     Failure/Error: ruby "-I#{Warbler::WARBLER_HOME}/lib", File.join(@orig_dir, 'spec/drb_helper.rb')
     
     Errno::EINTR:
       Interrupted system call - Another thread waited the process started by system().
     # ./spec/spec_helper.rb:132:in 'block in run_out_of_process_with_drb'

  2) Warbler::Jar with Bundler when frozen with the runnable feature can run commands in the generated warfile
     Failure/Error: expect(stderr.readlines.join).to eq("")
     
       expected: ""
            got: "/private/var/folders/h_/tmq357111c18sxbwlyq34mh80000gn/T/jruby11766745306540500674extract/gems/gems/...tarting from Ruby 3.5.0.\nYou can add ostruct to your Gemfile or gemspec to silence this warning.\n"
     
       (compared using ==)
     
       Diff:
       @@ -0,0 +1,2 @@
       +/private/var/folders/h_/tmq357111c18sxbwlyq34mh80000gn/T/jruby11766745306540500674extract/gems/gems/rake-12.3.3/exe/rake:27: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.5.0.
       +You can add ostruct to your Gemfile or gemspec to silence this warning.
       
     # ./spec/warbler/bundler_spec.rb:226:in 'block in <main>'

  3) Warbler::Jar with Bundler when deployment includes the bundler gem
     Failure/Error: expect(file_list(%r{gems/bundler-.*/lib})).to_not be_empty
       expected `[].empty?` to be falsey, got true
     # ./spec/warbler/bundler_spec.rb:240:in 'block in <main>'

  4) Warbler::Task should allow bytecode version in config
     Failure/Error: expect(class_file_bytes[6..7]).to eq bytecode_version.map { |magic_char| magic_char.chr }.join
     
       expected: #<Encoding:US-ASCII> "\x004"
            got: #<Encoding:ASCII-8BIT> "\x00A"
     
       (compared using ==)
     # ./spec/warbler/task_spec.rb:137:in 'block in <main>'
     # ./lib/warbler/zip_support.rb:10:in 'open'
     # ./spec/warbler/task_spec.rb:133:in 'block in <main>'

The first failure seems to be an issue with the subprocess launch of drb, perhaps using some old pattern for launching processes

The second failure is due to ostruct being a stdlib gem starting in Ruby 3.5 and warning right now. Adding to Gemfile should fix this.

The third failure and fourth failure need investigation.

headius added 5 commits June 20, 2025 17:01
Don't change the java.specification.version!
JRuby 10 only supports the Java 21 bytecode version "0x41" because
there's no later LTS and because 21 is the minimum Java supported.
I modify the test here to match those limitations.
ostruct will be moved out of default gems in 3.5, so loading it
from stdlib without a gem dependency causes warnings. Those
warnings lead to a test failure due to extraneous output.
@headius
Copy link
Member Author
headius commented Jun 20, 2025

I've dealt with the ostruct issue by adding it as a dependency and using a newer version of rake that doesn't also use it blindly.

The bytecode version failure was due to JRuby 10 always using bytecode versions higher than 21, since that's the minimum version it supports. I patched the test to handle that situation. I also modified the way this code tries to specify a specific bytecode version; tweaking java.specification.version directly seems pretty icky and isn't needed now in any case.

This is using jbundler 0.9.5 which is unreleased, so it will just fail hard until that's pushed.

@olleolleolle
Copy link
Member

Thanks for this work and for the excellent updates along the way. Easy to learn from, super helpful.

headius added 4 commits June 23, 2025 11:18
I'm not positive whether this is a kosher change, given that the
spec seems to want bundler's lib files to also be included in the
jar, but it may be excluding those files because it is a default
gem. In any case, the exe files are included so we'll expect that
they are there.
@headius
Copy link
Member Author
headius commented Jun 23, 2025

The DRbServer used for running some tests remains a little flaky, but with latest changes this should be green on JRuby 10.

jbundler 0.9.5 has been released and that project moved to JRuby org control so CI should also be green (or soon).

@olleolleolle
Copy link
Member

@headius Perhaps a step "just run 1 version of Bundler" could simplify the look of the CI matrix just a little. That is: deleting "2.6.3" from the string "21, jruby-head, 2.6.3".

headius added 2 commits June 23, 2025 12:32
Letting this be open-ended may use a newer jruby-jars than the
current JRuby, which breaks testing if that version requires a
newer version of Java.
Using a head build breaks because the maven tooling warbler uses
cannot handle a snapshot version.
@headius
Copy link
Member Author
headius commented Jun 24, 2025

@olleolleolle Yeah good idea. No really compelling reason to test against several versions anymore.

headius added 6 commits June 23, 2025 20:14
Might be useful later but doesn't add anything during this upgrade.
I'm not sure how this is getting into setup-ruby but because it
was installed with a different version, RubyGems complains. Those
complaints appear to be causing specs to fail.
@headius headius merged commit b47f903 into jruby:master Jun 25, 2025
6 checks passed
@headius headius deleted the renaissance branch June 25, 2025 02:43
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.

Updating and releasing with modern libs
2 participants
0