diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0fda4072..585b808b 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -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' @@ -54,9 +54,9 @@ 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 @@ -64,6 +64,10 @@ jobs: 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' diff --git a/Appraisals b/Appraisals index ef834bbd..655c29fd 100644 --- a/Appraisals +++ b/Appraisals @@ -25,3 +25,7 @@ end appraise "rails72" do gem "rails", "~> 7.2.0" end + +appraise "rails80" do + gem "rails", "~> 8.0.0" +end \ No newline at end of file diff --git a/History.md b/History.md index 9233470f..aecb45d4 100644 --- a/History.md +++ b/History.md @@ -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 diff --git a/README.md b/README.md index e0c89cf1..c7f0dcec 100644 --- a/README.md +++ b/README.md @@ -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.** @@ -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) @@ -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 diff --git a/gemfiles/rails80.gemfile b/gemfiles/rails80.gemfile new file mode 100644 index 00000000..cc545881 --- /dev/null +++ b/gemfiles/rails80.gemfile @@ -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 diff --git a/gemfiles/rails80.gemfile.lock b/gemfiles/rails80.gemfile.lock new file mode 100644 index 00000000..074c432c --- /dev/null +++ b/gemfiles/rails80.gemfile.lock @@ -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 diff --git a/pom.xml b/pom.xml index b1ffe421..5afc8034 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.jruby.rack jruby-rack - 1.2.4-SNAPSHOT + 1.3.0-SNAPSHOT JRuby-Rack https://github.com/jruby/jruby-rack/ diff --git a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java index 14f29b27..f0771c30 100644 --- a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java +++ b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java @@ -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() ) ) { diff --git a/src/main/java/org/jruby/rack/DefaultRackConfig.java b/src/main/java/org/jruby/rack/DefaultRackConfig.java index 44867c38..603b260e 100644 --- a/src/main/java/org/jruby/rack/DefaultRackConfig.java +++ b/src/main/java/org/jruby/rack/DefaultRackConfig.java @@ -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. @@ -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"); diff --git a/src/main/java/org/jruby/rack/RackConfig.java b/src/main/java/org/jruby/rack/RackConfig.java index 6eaa4c2e..4da4db42 100644 --- a/src/main/java/org/jruby/rack/RackConfig.java +++ b/src/main/java/org/jruby/rack/RackConfig.java @@ -7,8 +7,6 @@ package org.jruby.rack; -import org.jruby.CompatVersion; - import java.io.PrintStream; import java.util.Map; @@ -32,12 +30,6 @@ public interface RackConfig { * @return STDERR */ PrintStream getErr(); - - /** - * Return the Ruby version that JRuby should run. - * @return RUBY_VERSION (e.g. 1.8, 1.9) - */ - CompatVersion getCompatVersion(); /** * Return the rackup Ruby script to be used to launch the application. diff --git a/src/main/java/org/jruby/rack/embed/Config.java b/src/main/java/org/jruby/rack/embed/Config.java index 746b6ce4..fb63cdd9 100644 --- a/src/main/java/org/jruby/rack/embed/Config.java +++ b/src/main/java/org/jruby/rack/embed/Config.java @@ -27,7 +27,6 @@ import java.io.PrintStream; import java.util.Map; -import org.jruby.CompatVersion; import org.jruby.Ruby; import org.jruby.rack.DefaultRackConfig; import org.jruby.rack.RackConfig; @@ -44,7 +43,6 @@ public class Config implements RackConfig { private RackLogger logger; private Map rubyENV; - private CompatVersion compatVersion; public Config() { delegate = new DefaultRackConfig() { @@ -61,31 +59,11 @@ public String getProperty(String key, String defaultValue) { }; } - /* - Config(final RackConfig config) { - delegate = new DefaultRackConfig() { - - @Override - public String getProperty(String key, String defaultValue) { - String value = config.getProperty(key, null); - if ( value != null ) return value; - - value = Config.this.resolveProperty(key); - return value != null ? value : super.getProperty(key, defaultValue); - } - - @Override - public RackLogger defaultLogger() { return null; } - - }; - } */ - @SuppressWarnings("unchecked") public void doInitialize(final Ruby runtime) { setOut( runtime.getOut() ); setErr( runtime.getErr() ); rubyENV = runtime.getENV(); - compatVersion = runtime.getInstanceConfig().getCompatVersion(); } @@ -119,10 +97,6 @@ public final Number getNumberProperty(String key, Number defaultValue) { return delegate.getNumberProperty(key, defaultValue); } - public CompatVersion getCompatVersion() { - return compatVersion; - } - public RackLogger getLogger() { if (logger == null) { logger = delegate.getLogger(); diff --git a/src/main/ruby/jruby/rack/version.rb b/src/main/ruby/jruby/rack/version.rb index c84e9e0c..d77aa9b6 100644 --- a/src/main/ruby/jruby/rack/version.rb +++ b/src/main/ruby/jruby/rack/version.rb @@ -8,6 +8,6 @@ module JRuby module Rack - VERSION = '1.2.4.SNAPSHOT' + VERSION = '1.3.0.SNAPSHOT' end end diff --git a/src/spec/ruby/jruby/rack/error_app_spec.rb b/src/spec/ruby/jruby/rack/error_app_spec.rb index 1fae7967..1ecb5a8d 100644 --- a/src/spec/ruby/jruby/rack/error_app_spec.rb +++ b/src/spec/ruby/jruby/rack/error_app_spec.rb @@ -161,7 +161,7 @@ def in_tmpdir_with_files(files = {}) end yield path ensure - FileUtils.rm_rf(path) if path && File.exists?(path) + FileUtils.rm_rf(path) if path && File.exist?(path) end end diff --git a/src/spec/ruby/jruby/rack/integration_spec.rb b/src/spec/ruby/jruby/rack/integration_spec.rb index 9464ebbb..4f916e1b 100644 --- a/src/spec/ruby/jruby/rack/integration_spec.rb +++ b/src/spec/ruby/jruby/rack/integration_spec.rb @@ -15,15 +15,11 @@ before(:all) { require 'fileutils' } - #after(:all) { JRuby::Rack.context = nil } - describe 'rack (lambda)' do before do @servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new "file://#{STUB_DIR}/rack" @servlet_context.logger = raise_logger - # make sure we always boot runtimes in the same mode as specs : - set_compat_version @servlet_context end it "initializes" do @@ -136,7 +132,6 @@ def base_path; "file://#{STUB_DIR}/rails30" end before :all do initialize_rails nil, base_path end - after(:all) { restore_rails } it "loaded rack ~> 1.2" do @runtime = @rack_factory.getApplication.getRuntime @@ -435,27 +430,12 @@ def initialize_rails(env = nil, servlet_context = @servlet_context) @servlet_context ||= servlet_context end - def restore_rails - #ENV['RACK_ENV'] = ENV_COPY['RACK_ENV'] if ENV.key?('RACK_ENV') - #ENV['RAILS_ENV'] = ENV_COPY['RAILS_ENV'] if ENV.key?('RAILS_ENV') - end - def new_servlet_context(base_path = nil) servlet_context = org.jruby.rack.mock.RackLoggingMockServletContext.new base_path servlet_context.logger = raise_logger - prepare_servlet_context servlet_context servlet_context end - def prepare_servlet_context(servlet_context) - set_compat_version servlet_context - end - - def set_compat_version(servlet_context = @servlet_context); require 'jruby' - compat_version = JRuby.runtime.getInstanceConfig.getCompatVersion # RUBY1_9 - servlet_context.addInitParameter("jruby.compat.version", compat_version.to_s) - end - private GEMFILES_DIR = File.expand_path('../../../gemfiles', STUB_DIR) diff --git a/src/spec/ruby/rack/application_spec.rb b/src/spec/ruby/rack/application_spec.rb index 8d5fa895..ed22c484 100644 --- a/src/spec/ruby/rack/application_spec.rb +++ b/src/spec/ruby/rack/application_spec.rb @@ -390,13 +390,6 @@ def newRuntime() # use the current runtime instead of creating new should_eval_as_eql_to "require 'yaml'", true # -ryaml not processed end - it "handles jruby.compat.version == '1.9' and starts in 1.9 mode" do - set_config 'jruby.compat.version', '1.9' - #@rack_config.stub(:getCompatVersion).and_return org.jruby.CompatVersion::RUBY1_9 - @runtime = app_factory.new_runtime - @runtime.is1_9.should be_truthy - end - it "handles jruby.runtime.arguments == '-X+O -Ke' and start with object space enabled and KCode EUC" do set_config 'jruby.runtime.arguments', '-X+O -Ke' #@rack_config.stub(:getRuntimeArguments).and_return ['-X+O', '-Ke'].to_java(:String) diff --git a/src/spec/ruby/rack/config_spec.rb b/src/spec/ruby/rack/config_spec.rb index 3a31e222..6039d71d 100644 --- a/src/spec/ruby/rack/config_spec.rb +++ b/src/spec/ruby/rack/config_spec.rb @@ -184,56 +184,6 @@ def expect_empty_env(env) end - it "sets compat version from init parameter" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "RUBY1_9" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY1_9 - end - - it "sets compat version from init parameter (dot syntax)" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "1.8" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY1_8 - end - - it "leaves compat version nil if not specified" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return nil - expect( config.getCompatVersion ).to be nil - end - - it "leaves compat version nil if invalid value specified" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "4.2" - expect( config.getCompatVersion ).to be nil - end - - it "sets compat version from init parameter (head-syntax)" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "1.9.3-SNAPSHOT" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY1_9 - end - - if JRUBY_VERSION >= '1.7.0' - it "sets compat version 2.0 from init parameter" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "RUBY2_0" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY2_0 - end - - it "sets compat version 2.0 from init parameter (dot syntax)" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "2_0" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY2_0 - end - - it "sets compat version 2.0 from init parameter (head-syntax)" do - @servlet_context.should_receive(:getInitParameter).with("jruby.compat.version"). - and_return "2.0.0.dev" - expect( config.getCompatVersion ).to be org.jruby.CompatVersion::RUBY2_0 - end - end - describe "custom-properties" do it "parser an int property" do diff --git a/src/spec/ruby/rack/embed/config_spec.rb b/src/spec/ruby/rack/embed/config_spec.rb index 852acdb8..5a6a6b0d 100644 --- a/src/spec/ruby/rack/embed/config_spec.rb +++ b/src/spec/ruby/rack/embed/config_spec.rb @@ -83,12 +83,6 @@ end end - it "sets compat version from runtime" do - require 'jruby' - compat_version = JRuby.runtime.instance_config.compat_version - expect( @config.compat_version ).to eql compat_version - end - it "sets out/err streams from runtime" do out = java.io.ByteArrayOutputStream.new err = java.io.ByteArrayOutputStream.new