From edfc8a8ae134ed82f4709fa2853b9dd954db7848 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 21 Dec 2022 13:49:49 +0100 Subject: [PATCH] Require Ruby 2.3+ and drop Ruby 2.2 support * Set `required_ruby_version` to 2.3. * `rb_data_object_alloc()` is deprecated since a long time by `rb_data_object_wrap()` but that is not available in Ruby 2.2, so drop Ruby 2.2 support. --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 3 ++ README.md | 2 +- concurrent-ruby-edge.gemspec | 2 +- concurrent-ruby-ext.gemspec | 2 +- concurrent-ruby.gemspec | 2 +- .../concurrent/utility/engine.rb | 4 -- .../ruby_thread_pool_executor_spec.rb | 48 +++++++++---------- 8 files changed, 31 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 767f727de..74b2d6280 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - ruby: [2.2, 2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby] + ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, jruby, truffleruby] env: JAVA_OPTS: '-Xmx1024m' diff --git a/CHANGELOG.md b/CHANGELOG.md index bad004460..e65821c1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## Current +* (#975) Set the Ruby compatibility version at 2.3 +* (#972) Remove Rubinius-related code + ## Release v1.1.10 concurrent-ruby: diff --git a/README.md b/README.md index de7b9ba36..bb219aa6c 100644 --- a/README.md +++ b/README.md @@ -259,7 +259,7 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m ## Supported Ruby versions -* MRI 2.2 and above +* MRI 2.3 and above * Latest JRuby 9000 * Latest TruffleRuby diff --git a/concurrent-ruby-edge.gemspec b/concurrent-ruby-edge.gemspec index 3d2741f17..02383d346 100644 --- a/concurrent-ruby-edge.gemspec +++ b/concurrent-ruby-edge.gemspec @@ -23,7 +23,7 @@ be obeyed though. Features developed in `concurrent-ruby-edge` are expected to m Please see http://concurrent-ruby.com for more information. TXT - s.required_ruby_version = '>= 2.2' + s.required_ruby_version = '>= 2.3' s.add_runtime_dependency 'concurrent-ruby', "~> #{Concurrent::VERSION}" end diff --git a/concurrent-ruby-ext.gemspec b/concurrent-ruby-ext.gemspec index 0560d2c54..534822de0 100644 --- a/concurrent-ruby-ext.gemspec +++ b/concurrent-ruby-ext.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.require_paths = ['lib'] s.extensions = 'ext/concurrent-ruby-ext/extconf.rb' - s.required_ruby_version = '>= 2.2' + s.required_ruby_version = '>= 2.3' s.add_runtime_dependency 'concurrent-ruby', "= #{Concurrent::VERSION}" end diff --git a/concurrent-ruby.gemspec b/concurrent-ruby.gemspec index d493b1b8d..761919a53 100644 --- a/concurrent-ruby.gemspec +++ b/concurrent-ruby.gemspec @@ -27,5 +27,5 @@ Gem::Specification.new do |s| TXT s.metadata["source_code_uri"] = "https://github.com/ruby-concurrency/concurrent-ruby" s.metadata["changelog_uri"] = "https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md" - s.required_ruby_version = '>= 2.2' + s.required_ruby_version = '>= 2.3' end diff --git a/lib/concurrent-ruby/concurrent/utility/engine.rb b/lib/concurrent-ruby/concurrent/utility/engine.rb index 4841fac60..89dce5b0c 100644 --- a/lib/concurrent-ruby/concurrent/utility/engine.rb +++ b/lib/concurrent-ruby/concurrent/utility/engine.rb @@ -7,10 +7,6 @@ def on_jruby? RUBY_ENGINE == 'jruby' end - def on_jruby_9000? - on_jruby? && ruby_version(JRUBY_VERSION, :>=, 9, 0, 0) - end - def on_cruby? RUBY_ENGINE == 'ruby' end diff --git a/spec/concurrent/executor/ruby_thread_pool_executor_spec.rb b/spec/concurrent/executor/ruby_thread_pool_executor_spec.rb index d9d54b13a..64ad79805 100644 --- a/spec/concurrent/executor/ruby_thread_pool_executor_spec.rb +++ b/spec/concurrent/executor/ruby_thread_pool_executor_spec.rb @@ -157,36 +157,34 @@ def eventually(mutex: nil, timeout: 5, &block) end end - if Concurrent.on_cruby? && Concurrent.ruby_version(:>=, 2, 3, 0) - context 'threads naming' do - subject do - opts = { min_threads: 2 } - opts[:name] = pool_name if pool_name - described_class.new(opts) - end + context 'threads naming' do + subject do + opts = { min_threads: 2 } + opts[:name] = pool_name if pool_name + described_class.new(opts) + end - let(:names) { Concurrent::Set.new } + let(:names) { Concurrent::Set.new } - before do - subject.post(names) { |names| names << Thread.current.name } - subject.post(names) { |names| names << Thread.current.name } - subject.shutdown - subject.wait_for_termination(pool_termination_timeout) - expect(names.size).to eq 2 - end + before do + subject.post(names) { |names| names << Thread.current.name } + subject.post(names) { |names| names << Thread.current.name } + subject.shutdown + subject.wait_for_termination(pool_termination_timeout) + expect(names.size).to eq 2 + end - context 'without pool name' do - let(:pool_name) { } - it 'sets counted name' do - expect(names.all? { |name| name =~ /^worker-\d+$/ }).to be true - end + context 'without pool name' do + let(:pool_name) { } + it 'sets counted name' do + expect(names.all? { |name| name =~ /^worker-\d+$/ }).to be true end + end - context 'with pool name' do - let(:pool_name) { 'MyExecutor' } - it 'sets counted name' do - expect(names.all? { |name| name =~ /^MyExecutor-worker-\d+$/ }).to be true - end + context 'with pool name' do + let(:pool_name) { 'MyExecutor' } + it 'sets counted name' do + expect(names.all? { |name| name =~ /^MyExecutor-worker-\d+$/ }).to be true end end end