Skip to content

[v1.3.x] Introduce compatibility with JRuby 10 #273

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 2 commits into from
May 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

strategy:
matrix:
jruby_version: [ '9.3.15.0', '9.4.12.1' ] # , '10.0.0.1'
jruby_version: [ '9.3.15.0', '9.4.12.1', '10.0.0.1' ]
java_version: [ '8', '11', '17', '21' ]
exclude:
- jruby_version: '10.0.0.1'
Expand Down Expand Up @@ -54,16 +54,20 @@ jobs:

strategy:
matrix:
jruby_version: [ '9.3.15.0', '9.4.12.1' ] # , '10.0.0.1'
jruby_version: [ '9.3.15.0', '9.4.12.1', '10.0.0.1' ]
java_version: [ '8', '11', '17', '21' ]
appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72' ]
appraisal: [ 'rails50', 'rails52', 'rails60', 'rails61', 'rails70', 'rails71', 'rails72', 'rails80' ]
exclude:
- jruby_version: '9.3.15.0'
appraisal: 'rails70' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support
- jruby_version: '9.3.15.0'
appraisal: 'rails71' # Requires Ruby 2.7 compatibility, which JRuby 9.3 does not support
- jruby_version: '9.3.15.0'
appraisal: 'rails72' # Requires Ruby 3.1 compatibility, which JRuby 9.3 does not support
- jruby_version: '9.3.15.0'
appraisal: 'rails80' # Requires Ruby 3.4 compatibility, which JRuby 9.3 does not support
- jruby_version: '9.4.12.1'
appraisal: 'rails80' # Requires Ruby 3.4 compatibility, which JRuby 9.4 does not support
- jruby_version: '10.0.0.1'
java_version: '8' # JRuby 10 requires Java 21
- jruby_version: '10.0.0.1'
Expand Down
4 changes: 4 additions & 0 deletions Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ end
appraise "rails72" do
gem "rails", "~> 7.2.0"
end

appraise "rails80" do
gem "rails", "~> 8.0.0"
end
5 changes: 5 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.3.0 (UNRELEASED)

- Adds basic compatibility with JRuby 10.0
- Drop unnecessary jruby.compat.version and RackConfig.getCompatVersion() API

## 1.2.4 (UNRELEASED)

- update (bundled) rack to 2.2.16
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ JRuby-Rack supports Rails as well as any Rack-compatible Ruby web framework.

For more information on Rack, visit http://rack.github.io/.

**This README (master) targets JRuby-Rack 1.2. Please use the
**This README (master) targets JRuby-Rack 1.3. Please use the
[1.1-stable](https://github.com/jruby/jruby-rack/tree/1.1-stable) branch for
current stable 1.1.x releases.**

Expand All @@ -15,12 +15,16 @@ current stable 1.1.x releases.**

## Compatibility

JRuby-Rack 1.3.x
- aims to be compatible with JRuby 9.3 -> 10.0 and their supported JDK versions
- supports any container compatible with Java Servlet 3.0 API

JRuby-Rack 1.2.x
- aims to be compatible with JRuby >= 9.3 and its supported JDK versions
- compatible with JRuby 9.3 -> 9.4 and their supported JDK versions
- supports any container compatible with Java Servlet 3.0 API

JRuby-Rack 1.1.x
- aims to be compatible with JRuby >= 1.6.4 (used successfully through JRuby 9.4.x)
- aims to be compatible with JRuby >= 1.6.4 (used successfully through JRuby 9.4)
- supports any container compatible with Java Servlet 2.5 API (JEE 5)


Expand Down Expand Up @@ -206,8 +210,6 @@ as context init parameters in web.xml or as VM-wide system properties.
sub-path of the main servlet context root.
- `gem.path`: Relative path to the bundled gem repository. Defaults to
*/WEB-INF/gems*.
- `jruby.compat.version`: Set to "1.8" or "1.9" to make JRuby run a specific
version of Ruby (same as the --1.8 / --1.9 command line flags).
- `jruby.min.runtimes`: For non-threadsafe Rails applications using a runtime
pool, specify an integer minimum number of runtimes to hold in the pool.
- `jruby.max.runtimes`: For non-threadsafe Rails applications, an integer
Expand Down
15 changes: 15 additions & 0 deletions gemfiles/rails80.gemfile
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.2", group: :test, require: nil
gem "rspec", group: :test
gem "rails", "~> 8.0.0"

group :default do
gem "rack", "~> 2.2"
end

group :development do
gem "appraisal", require: nil
end
211 changes: 211 additions & 0 deletions gemfiles/rails80.gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (8.0.2)
actionpack (= 8.0.2)
activesupport (= 8.0.2)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
zeitwerk (~> 2.6)
actionmailbox (8.0.2)
actionpack (= 8.0.2)
activejob (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
mail (>= 2.8.0)
actionmailer (8.0.2)
actionpack (= 8.0.2)
actionview (= 8.0.2)
activejob (= 8.0.2)
activesupport (= 8.0.2)
mail (>= 2.8.0)
rails-dom-testing (~> 2.2)
actionpack (8.0.2)
actionview (= 8.0.2)
activesupport (= 8.0.2)
nokogiri (>= 1.8.5)
rack (>= 2.2.4)
rack-session (>= 1.0.1)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
useragent (~> 0.16)
actiontext (8.0.2)
actionpack (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (8.0.2)
activesupport (= 8.0.2)
builder (~> 3.1)
erubi (~> 1.11)
rails-dom-testing (~> 2.2)
rails-html-sanitizer (~> 1.6)
activejob (8.0.2)
activesupport (= 8.0.2)
globalid (>= 0.3.6)
activemodel (8.0.2)
activesupport (= 8.0.2)
activerecord (8.0.2)
activemodel (= 8.0.2)
activesupport (= 8.0.2)
timeout (>= 0.4.0)
activestorage (8.0.2)
actionpack (= 8.0.2)
activejob (= 8.0.2)
activerecord (= 8.0.2)
activesupport (= 8.0.2)
marcel (~> 1.0)
activesupport (8.0.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
uri (>= 0.13.1)
appraisal (2.5.0)
bundler
rake
thor (>= 0.14.0)
base64 (0.2.0)
benchmark (0.4.0)
bigdecimal (3.1.9-java)
builder (3.3.0)
concurrent-ruby (1.3.5)
connection_pool (2.5.3)
crass (1.0.6)
date (3.4.1-java)
diff-lcs (1.6.2)
drb (2.2.1)
erubi (1.13.1)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-console (0.8.0-java)
irb (1.15.2)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jar-dependencies (0.5.5)
logger (1.7.0)
loofah (2.24.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
mail (2.8.1)
mini_mime (>= 0.1.1)
net-imap
net-pop
net-smtp
marcel (1.0.4)
mini_mime (1.1.5)
minitest (5.25.5)
net-imap (0.5.8)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.1)
net-protocol
nio4r (2.7.4-java)
nokogiri (1.18.8-java)
racc (~> 1.4)
pp (0.6.2)
prettyprint
prettyprint (0.2.0)
psych (5.2.6-java)
date
jar-dependencies (>= 0.1.7)
racc (1.8.1-java)
rack (2.2.15)
rack-session (1.0.2)
rack (< 3)
rack-test (2.2.0)
rack (>= 1.3)
rackup (1.0.1)
rack (< 3)
webrick
rails (8.0.2)
actioncable (= 8.0.2)
actionmailbox (= 8.0.2)
actionmailer (= 8.0.2)
actionpack (= 8.0.2)
actiontext (= 8.0.2)
actionview (= 8.0.2)
activejob (= 8.0.2)
activemodel (= 8.0.2)
activerecord (= 8.0.2)
activestorage (= 8.0.2)
activesupport (= 8.0.2)
bundler (>= 1.15.0)
railties (= 8.0.2)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.2)
loofah (~> 2.21)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (8.0.2)
actionpack (= 8.0.2)
activesupport (= 8.0.2)
irb (~> 1.13)
rackup (>= 1.0.0)
rake (>= 12.2)
thor (~> 1.0, >= 1.2.2)
zeitwerk (~> 2.6)
rake (13.2.1)
rdoc (6.13.1)
psych (>= 4.0.0)
reline (0.6.1)
io-console (~> 0.5)
rspec (3.13.0)
rspec-core (~> 3.13.0)
rspec-expectations (~> 3.13.0)
rspec-mocks (~> 3.13.0)
rspec-core (3.13.3)
rspec-support (~> 3.13.0)
rspec-expectations (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-mocks (3.13.4)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.13.0)
rspec-support (3.13.3)
securerandom (0.4.1)
thor (1.3.2)
timeout (0.4.3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (1.0.3)
useragent (0.16.11)
webrick (1.9.1)
websocket-driver (0.7.7-java)
base64
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
zeitwerk (2.7.2)

PLATFORMS
universal-java-21

DEPENDENCIES
appraisal
rack (~> 2.2)
rails (~> 8.0.0)
rake (~> 13.2)
rspec

BUNDLED WITH
2.6.3
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>org.jruby.rack</groupId>
<artifactId>jruby-rack</artifactId>
<version>1.2.4-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<name>JRuby-Rack</name>
<url>https://github.com/jruby/jruby-rack/</url>
<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ protected RubyInstanceConfig initRuntimeConfig(final RubyInstanceConfig config)
// Process arguments, namely any that might be in RUBYOPT
config.processArguments(rackConfig.getRuntimeArguments());

if ( rackConfig.getCompatVersion() != null ) {
config.setCompatVersion(rackConfig.getCompatVersion());
}

try { // try to set jruby home to jar file path
final URL resource = Ruby.class.getResource("/META-INF/jruby.home");
if ( resource != null && "jar".equals( resource.getProtocol() ) ) {
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/org/jruby/rack/DefaultRackConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jruby.CompatVersion;
import org.jruby.rack.logging.OutputStreamLogger;
import org.jruby.rack.logging.StandardOutLogger;
import org.jruby.util.SafePropertyAccessor;
import static org.jruby.rack.RackLogger.Level.*;

/**
* A base implementation of that retrieves settings from system properties.
Expand Down Expand Up @@ -77,28 +73,6 @@ public void setQuiet(boolean quiet) {
this.quiet = quiet;
}

@Override
public CompatVersion getCompatVersion() {
final String version = getProperty("jruby.compat.version");
if ( version != null ) {
// we handle 1.8, RUBY1_9, --2.0 1_9 2.1.0.dev etc :
final Pattern pattern = Pattern.compile("([123])[._]([8901234567])");
final Matcher matcher = pattern.matcher(version);
if ( matcher.find() ) {
final String name = "RUBY" +
matcher.group(1) + '_' + matcher.group(2);
try {
return Enum.valueOf(CompatVersion.class, name);
}
catch (IllegalArgumentException e) {
getLogger().log(WARN,
"could not resolve compat version from '"+ version +"' will use default", e);
}
}
}
return null;
}

@Override
public String getRackup() {
return getProperty("rackup");
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/jruby/rack/RackConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

package org.jruby.rack;

import org.jruby.CompatVersion;

import java.io.PrintStream;
import java.util.Map;

Expand All @@ -32,12 +30,6 @@ public interface RackConfig {
* @return <code>STDERR</code>
*/
PrintStream getErr();

/**
* Return the Ruby version that JRuby should run.
* @return <code>RUBY_VERSION</code> (e.g. 1.8, 1.9)
*/
CompatVersion getCompatVersion();

/**
* Return the rackup Ruby script to be used to launch the application.
Expand Down
Loading