Skip to content

Commit 0648cca

Browse files
authored
Merge pull request #419 from chadlwilson/1.2-safe-jruby-10
1.2: Backport JRuby 10.0 and Rails 8.0 compatbility
2 parents 1ac9a9c + 2a7882c commit 0648cca

39 files changed

Lines changed: 490 additions & 124 deletions

.github/workflows/maven.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,16 @@ jobs:
1919

2020
strategy:
2121
matrix:
22-
jruby_version: [ '9.3.15.0', '9.4.14.0' ]
22+
jruby_version: [ '9.3.15.0', '9.4.14.0', '10.0.5.0' ]
2323
java_version: [ '8', '11', '17', '21', '25' ]
2424
rack_version: [ '~> 2.2.0' ]
25+
exclude:
26+
- jruby_version: '10.0.5.0'
27+
java_version: '8' # JRuby 10 requires Java 21
28+
- jruby_version: '10.0.5.0'
29+
java_version: '11' # JRuby 10 requires Java 21
30+
- jruby_version: '10.0.5.0'
31+
java_version: '17' # JRuby 10 requires Java 21
2532
fail-fast: false
2633

2734
steps:
@@ -59,16 +66,27 @@ jobs:
5966
'rails70_rack22',
6067
'rails71_rack22',
6168
'rails72_rack22',
69+
'rails80_rack22',
6270
]
63-
jruby_version: [ '9.3.15.0', '9.4.14.0' ]
71+
jruby_version: [ '9.3.15.0', '9.4.14.0', '10.0.5.0' ]
6472
java_version: [ '8', '11', '17', '21', '25' ]
6573
exclude:
74+
- jruby_version: '10.0.5.0'
75+
java_version: '8' # JRuby 10 requires Java 21
76+
- jruby_version: '10.0.5.0'
77+
java_version: '11' # JRuby 10 requires Java 21
78+
- jruby_version: '10.0.5.0'
79+
java_version: '17' # JRuby 10 requires Java 21
6680
- appraisal: 'rails70_rack22' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support
6781
jruby_version: '9.3.15.0'
6882
- appraisal: 'rails71_rack22' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support
6983
jruby_version: '9.3.15.0'
7084
- appraisal: 'rails72_rack22' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support
7185
jruby_version: '9.3.15.0'
86+
- appraisal: 'rails80_rack22' # Requires Ruby 3.4 compatibility, which JRuby 9.3 does not support
87+
jruby_version: '9.3.15.0'
88+
- appraisal: 'rails80_rack22' # Requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
89+
jruby_version: '9.4.14.0'
7290
fail-fast: false
7391

7492
env:

Appraisals

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
version_spec = ->(prefix, desc) { "~> #{desc.split(prefix).last.insert(1, ".")}.0" }
22

3-
# Rails version -> rack versions in format
4-
# rails#{MAJOR}#{MINOR} => %w[ rack#{MAJOR}#{MINOR} ]
3+
# rails#{MAJOR}#{MINOR} => config_obj
54
{
6-
"rails50" => %w[rack22],
7-
"rails52" => %w[rack22],
8-
"rails60" => %w[rack22],
9-
"rails61" => %w[rack22],
10-
"rails70" => %w[rack22],
11-
"rails71" => %w[rack22],
12-
"rails72" => %w[rack22]
13-
}.each do |rails_desc, rack_descs|
14-
rack_descs.each do |rack_desc|
5+
"rails50" => {racks: %w[rack22], ext_gems: %w[mutex_m bigdecimal base64]},
6+
"rails52" => {racks: %w[rack22], ext_gems: %w[mutex_m bigdecimal]},
7+
"rails60" => {racks: %w[rack22], ext_gems: %w[mutex_m bigdecimal]},
8+
"rails61" => {racks: %w[rack22], ext_gems: %w[mutex_m bigdecimal]},
9+
"rails70" => {racks: %w[rack22]},
10+
"rails71" => {racks: %w[rack22]},
11+
"rails72" => {racks: %w[rack22]},
12+
"rails80" => {racks: %w[rack22]},
13+
}.each do |rails_desc, c|
14+
c[:racks].each do |rack_desc|
1515

1616
appraise "#{rails_desc}_#{rack_desc}" do
1717
group :default do
1818
gem "rack", version_spec.call("rack", rack_desc)
1919
gem "rails", version_spec.call("rails", rails_desc)
20+
21+
c[:ext_gems]&.each do |gem_name|
22+
gem gem_name
23+
end
2024
end
2125
end
2226
end

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 1.2.7 (UNRELEASED)
22

3+
- Fix compatibility with JRuby 10.0 and Rails 8.0 (#419)
34
- Fix ability to include and forward to JSPs under Rails (#370)
45
- Update (bundled) rack to 2.2.23 (#417)
56

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ For more information on Rack, visit http://rack.github.io/.
1313

1414
## Compatibility
1515

16-
| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes |
17-
|----------------------------------------------------------------|---------------|-----------|-----------|------|-----------|--------------------|----------------------------------------------------------------|
18-
| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 9.4 | 8+ | 5.0 → 7.2 | 3.0 (Java EE 6) |_Unofficial_: Servlet 3.1 → 4.0 also OK with most containers |
19-
| [**1.1**](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL @ 2024-05 | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) |_Unofficial_: Servlet 3.0 → 4.0 also OK with most containers |
20-
| [**1.0**](https://github.com/jruby/jruby-rack/tree/1.0.10) | EOL @ 2011-11 | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | |
16+
| JRuby-Rack Series | Status | Rack | JRuby | Java | Rails | Target Servlet API | Notes |
17+
|----------------------------------------------------------------|---------------|-----------|------------|------|-----------|--------------------|----------------------------------------------------------------|
18+
| [**1.2**](https://github.com/jruby/jruby-rack/tree/1.2-stable) | Maintained | 2.2 | 9.3 → 10.0 | 8+ | 5.0 → 8.0 | 3.0 (Java EE 6) |_Unofficial_: Servlet 3.1 → 4.0 also OK with most containers |
19+
| [**1.1**](https://github.com/jruby/jruby-rack/tree/1.1-stable) | EOL @ 2024-05 | 1.x → 2.2 | 1.6 → 9.4 | 6+ | 2.1 → 5.2 | 2.5 (Java EE 5) |_Unofficial_: Servlet 3.0 → 4.0 also OK with most containers |
20+
| [**1.0**](https://github.com/jruby/jruby-rack/tree/1.0.10) | EOL @ 2011-11 | 0.9 → 1.x | 1.1 → 1.9 | 5+ | 2.1 → 3.x | 2.5 (Java EE 5) | |
2121

2222
## Getting Started
2323

@@ -209,8 +209,6 @@ as context init parameters in web.xml or as VM-wide system properties.
209209
sub-path of the main servlet context root.
210210
- `gem.path`: Relative path to the bundled gem repository. Defaults to
211211
`/WEB-INF/gems`.
212-
- `jruby.compat.version`: Set to "1.8" or "1.9" to make JRuby run a specific
213-
version of Ruby (same as the --1.8 / --1.9 command line flags).
214212
- `jruby.min.runtimes`: For non-threadsafe Rails applications using a runtime
215213
pool, specify an integer minimum number of runtimes to hold in the pool.
216214
- `jruby.max.runtimes`: For non-threadsafe Rails applications, an integer

gemfiles/rails50_rack22.gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ gem "rspec", group: :test
88
group :default do
99
gem "rack", "~> 2.2.0"
1010
gem "rails", "~> 5.0.0"
11+
gem "mutex_m"
12+
gem "bigdecimal"
13+
gem "base64"
1114
end
1215

1316
group :development do

gemfiles/rails52_rack22.gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ gem "rspec", group: :test
88
group :default do
99
gem "rack", "~> 2.2.0"
1010
gem "rails", "~> 5.2.0"
11+
gem "mutex_m"
12+
gem "bigdecimal"
1113
end
1214

1315
group :development do

gemfiles/rails60_rack22.gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ gem "rspec", group: :test
88
group :default do
99
gem "rack", "~> 2.2.0"
1010
gem "rails", "~> 6.0.0"
11+
gem "mutex_m"
12+
gem "bigdecimal"
1113
end
1214

1315
group :development do

gemfiles/rails61_rack22.gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ gem "rspec", group: :test
88
group :default do
99
gem "rack", "~> 2.2.0"
1010
gem "rails", "~> 6.1.0"
11+
gem "mutex_m"
12+
gem "bigdecimal"
1113
end
1214

1315
group :development do

gemfiles/rails80_rack22.gemfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file was generated by Appraisal
2+
3+
source "https://rubygems.org"
4+
5+
gem "rake", "~> 13.3", group: :test, require: nil
6+
gem "rspec", group: :test
7+
8+
group :default do
9+
gem "rack", "~> 2.2.0"
10+
gem "rails", "~> 8.0.0"
11+
end
12+
13+
group :development do
14+
gem "appraisal", require: nil
15+
end

src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,6 @@ protected RubyInstanceConfig initRuntimeConfig(final RubyInstanceConfig config)
302302
// Process arguments, namely any that might be in RUBYOPT
303303
config.processArguments(rackConfig.getRuntimeArguments());
304304

305-
if ( rackConfig.getCompatVersion() != null ) {
306-
config.setCompatVersion(rackConfig.getCompatVersion());
307-
}
308-
309305
try { // try to set jruby home to jar file path
310306
final URL resource = Ruby.class.getResource("/META-INF/jruby.home");
311307
if ( resource != null && "jar".equals( resource.getProtocol() ) ) {
@@ -487,7 +483,7 @@ private void captureMessage(final RaiseException re) {
487483
rubyException.callMethod(context, "capture");
488484
rubyException.callMethod(context, "store");
489485
}
490-
catch (Exception e) {
486+
catch (Throwable e) {
491487
rackContext.log(INFO, "failed to capture exception message", e);
492488
// won't be able to capture anything
493489
}

0 commit comments

Comments
 (0)