-
Notifications
You must be signed in to change notification settings - Fork 137
1.2: Back-port JRuby 10 and Rails 8.0 compatibility #360
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
212ba5f
Remove processing of jruby.compat.version which is no longer needed f…
chadlwilson 144107c
Test against JRuby 10 and Rails 8.0
chadlwilson 33d1e7e
Test against JRuby 10.0.1.0
chadlwilson d6d7dd9
[test] Test against JRuby 10.0.2.0
chadlwilson d7c771e
[test] Generate Rails stub tests for 5.0 through 8.0
chadlwilson 1e74d51
[test] Re-order GHA definition for consistency with master/1.3
chadlwilson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # This file was generated by Appraisal | ||
|
|
||
| source "https://rubygems.org" | ||
|
|
||
| gem "rake", "~> 13.3", group: :test, require: nil | ||
| gem "rspec", group: :test | ||
|
|
||
| group :default do | ||
| gem "rack", "~> 2.2.0" | ||
| gem "rails", "~> 8.0.0" | ||
| end | ||
|
|
||
| group :development do | ||
| gem "appraisal", require: nil | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| package org.jruby; | ||
|
|
||
| /** | ||
| * Removed from JRuby Core as of 10.0; but deprecated and unused for a long time. | ||
| * <p/> | ||
| * Added back to jruby-rack 1.2.x to allow JRuby 10 support without an API changed, but | ||
| * will be removed in jruby-rack 1.3.0 | ||
| * <p/> | ||
| * @link https://github.com/jruby/jruby/blob/jruby-9.3/core/src/main/java/org/jruby/CompatVersion.java | ||
| * @deprecated since JRuby 9.2 with no replacement; for removal with jruby-rack 1.3.0 | ||
| */ | ||
| @Deprecated | ||
| public enum CompatVersion { | ||
|
|
||
| @Deprecated RUBY1_8, | ||
| @Deprecated RUBY1_9, | ||
| @Deprecated RUBY2_0, | ||
| @Deprecated RUBY2_1, | ||
| @Deprecated BOTH; | ||
|
|
||
| @Deprecated | ||
| public boolean is1_9() { | ||
| return this == RUBY1_9 || this == RUBY2_0 || this == RUBY2_1; | ||
| } | ||
|
|
||
| @Deprecated | ||
| public boolean is2_0() { | ||
| return this == RUBY2_0 || this == RUBY2_1; | ||
| } | ||
|
|
||
| @Deprecated | ||
| public static CompatVersion getVersionFromString(String compatString) { | ||
| if (compatString.equalsIgnoreCase("RUBY1_8")) { | ||
| return CompatVersion.RUBY1_8; | ||
| } else if (compatString.equalsIgnoreCase("1.8")) { | ||
| return CompatVersion.RUBY1_8; | ||
| } else if (compatString.equalsIgnoreCase("RUBY1_9")) { | ||
| return CompatVersion.RUBY1_9; | ||
| } else if (compatString.equalsIgnoreCase("1.9")) { | ||
| return CompatVersion.RUBY1_9; | ||
| } else if (compatString.equalsIgnoreCase("RUBY2_0")) { | ||
| return CompatVersion.RUBY2_0; | ||
| } else if (compatString.equalsIgnoreCase("2.0")) { | ||
| return CompatVersion.RUBY2_0; | ||
| } else if (compatString.equalsIgnoreCase("RUBY2_1")) { | ||
| return CompatVersion.RUBY2_1; | ||
| } else if (compatString.equalsIgnoreCase("2.1")) { | ||
| return CompatVersion.RUBY2_1; | ||
| } else { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| @Deprecated | ||
| public static boolean shouldBindMethod(CompatVersion runtimeVersion, CompatVersion methodVersion) { | ||
| if (runtimeVersion == RUBY1_8) return methodVersion == RUBY1_8 || methodVersion == BOTH; | ||
| if (runtimeVersion == RUBY1_9) return methodVersion == RUBY1_9 || methodVersion == BOTH; | ||
| if (runtimeVersion == RUBY2_0) return methodVersion == RUBY1_9 || methodVersion == RUBY2_0 || methodVersion == BOTH; | ||
| if (runtimeVersion == RUBY2_1) return methodVersion == RUBY1_9 || methodVersion == RUBY2_0 || methodVersion == RUBY2_1 || methodVersion == BOTH; | ||
| return false; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
src/spec/stub/rails80/app/controllers/application_controller.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| class ApplicationController < ActionController::Base | ||
| # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. | ||
| allow_browser versions: :modern | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| module ApplicationHelper | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
not sure this is a good idea, with proper modularization shouldn't even work (as the package is "owned" by a different .jar).
would personally just leave 1.2.x as is and not try to hack around to get it to work with latest JRuby...
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, this did occur to me. However is jruby-rack even possible to use within a modularised environment? It has no metadata. So is this an an academic concern or still real?
I'm yet to actually see such modularisation used in the wild in real applications, so I may be naive here.
Uh oh!
There was an error while loading. Please reload this page.
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.
Do you know an example of a Java web server that works in JPMS module mode? To my knowledge they all still use classpath mode (or OSGi which is a whole other can of worms jruby-rack doesn't support)
Uh oh!
There was an error while loading. Please reload this page.
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 honestly do not know, just smells like a bad idea.
There has been embedded use-cases with different class-path layouts than a typical .war.
Understand where this is coming from given the enum is self contained.
We'll still have the
org.jruby.CompatVersion(with <10) class around twice and can not guarantee which one will get loaded, shouldn't matter. 🤷If you get someone else e.g. @headius to bless this approach. 🙏
Personally would rather not go down this path, esp. given 1.3.0 without hacks is good to go but if there's smarter folks saying will do just fine... then 👍
Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, almost certainly a bad idea in the general case.
My thinking was just to make life easier for folks to upgrade and avoid issues like jruby/warbler#573 where someone uses JRuby 10 with Warbler and it sometimes works enough to confuse folks, except when there is a start-up error and that error is swallowed by this
CompatVersionproblem. Warbler doesn't define a maximum jruby version, but does define a< 1.3jruby-rack version so there is a bit more friction there.I was thinking that might allow us to keep the delta for 1.3 even smaller for folks - but I hear you..
Alternatively to this what we could possibly do on
1.2.xis disable the jruby-rack config capture (on init failure) for JRuby 10. The actual failure/issue right now only seems to come from theinstance_methodscall (JRubyMethodGathererinvocation) here:jruby-rack/src/main/ruby/jruby/rack/capture.rb
Lines 85 to 99 in 2bdcb42
So if we removed that, and if the user does not retrieve the CompatVersion in custom config, I don't think jruby/jruby-rack will cause the
CompatVersionclass to be loaded, despite the imports below because thegetCompatVersion()method is never invoked.jruby-rack/src/main/java/org/jruby/rack/RackConfig.java
Line 13 in 212ba5f
Would that be better to you - to just lose the rack config dump capability on JRuby 10 for
1.2.x? (unless you can think of an even smarter way to stop the.instance_methods(false)call from inspecting everything. :-)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 am reasonably confident that JRuby 10 works fine without the config dump being needed because the Warbler integration tests validate startup and a basic call to a Rails API work fine and are passing in master.
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.
That still sounds like a work-around for smt that could be fixed pushing patch jruby-rack/warbler versions.
On the jruby-rack (1.2.x) gem side by requiring to have the
required_ruby_version< 3.2then at runtime Bundler/RubyGems should validate.potentially same could be done on the Warbler side, althoughlikely less reasonable - what kind of version you're using to pack and at actual runtime might be different (as you mentioned on the Warbler ticket that jruby-jars requirement should get an upper limit).
Not sure I fully follow but sounds like things are getting complicated... 😉
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.
True, but we can't change the requirements for already pushed versions, so in practice that still that kinda leaves people ending up accidentally using incompatible combinations (ignoring yanking gems).
But yeah, ok. I'll leave this and refocus on Rack 3 and 1.3.
Would you be able to help push a release of this branch as it currently stands in that case?
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.
Diff: jruby-rack-1.2.5...1.2-stable