From 48dc0c79af448b9d444b365070d32c3e3201f817 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Mon, 13 Jan 2020 17:04:03 +0100 Subject: [PATCH 01/13] Revert "Do not build JRuby on CI as it is not supported anymore" This reverts commit e34971024b850541926b29f76f43a8dce0ca63ca. --- .circleci/config.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 709a62544c..687173c16e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,6 +77,15 @@ jobs: - build - test + build-jruby: + docker: + - image: circleci/jruby:9.2.8.0 + + working_directory: ~/repo + steps: + - build + - test_allow_failure + build-ruby-latest: docker: - image: circleci/ruby:latest @@ -111,3 +120,4 @@ workflows: - build-ruby-2_5 - build-ruby-2_6 - build-ruby-latest + - build-jruby From 7d4d7bf7ec8f0e7a1d561878832dbbde8d0ea646 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Tue, 14 Jan 2020 11:01:13 +0100 Subject: [PATCH 02/13] Do not add RbConfig keys that are not available --- spec/cucumber/formatter/backtrace_filter_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/cucumber/formatter/backtrace_filter_spec.rb b/spec/cucumber/formatter/backtrace_filter_spec.rb index 27563a63c7..43381756ec 100644 --- a/spec/cucumber/formatter/backtrace_filter_spec.rb +++ b/spec/cucumber/formatter/backtrace_filter_spec.rb @@ -15,8 +15,8 @@ module Formatter _anything__test/unit__anything_ _anything__Xgem/ruby__anything_ _anything__.rbenv/versions/2.3/bin/bundle__anything_] - trace << "_anything__#{RbConfig::CONFIG['rubyarchdir']}__anything_" - trace << "_anything__#{RbConfig::CONFIG['rubylibdir']}__anything_" + trace << "_anything__#{RbConfig::CONFIG['rubyarchdir']}__anything_" if RbConfig::CONFIG['rubyarchdir'] + trace << "_anything__#{RbConfig::CONFIG['rubylibdir']}__anything_" if RbConfig::CONFIG['rubylibdir'] @exception = Exception.new @exception.set_backtrace(trace) From 4d3e8820318bbae5461d74b3aad222786fdc338c Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Tue, 14 Jan 2020 11:12:54 +0100 Subject: [PATCH 03/13] Disable one failing scenario on JRuby Note: this may definitelly not be the best way to proceed, but the long term idea is to drop the `step` nesting, so spending time fixing this issue would be lost. --- features/docs/defining_steps/nested_steps.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/docs/defining_steps/nested_steps.feature b/features/docs/defining_steps/nested_steps.feature index f39869b06a..37bc5ba0a3 100644 --- a/features/docs/defining_steps/nested_steps.feature +++ b/features/docs/defining_steps/nested_steps.feature @@ -107,7 +107,7 @@ Feature: Nested Steps Liouville """ - @spawn @todo-windows + @spawn @todo-windows @todo-jruby @wip-jruby Scenario: Backtrace doesn't skip nested steps Given a step definition that looks like this: """ruby From cc248d79d91c8ae70281b5b5d68e331979124b20 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Tue, 25 Feb 2020 11:02:51 +0100 Subject: [PATCH 04/13] Disable Russian example with JRuby Remove useless reference to protobuf gem for JRuby --- Gemfile | 7 +------ examples/i18n/Rakefile | 37 ++++++++++++++++++++++++------------- gem_tasks/examples.rake | 3 ++- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Gemfile b/Gemfile index 798299d71d..e0d8625e9b 100644 --- a/Gemfile +++ b/Gemfile @@ -17,10 +17,5 @@ elsif !ENV['CUCUMBER_USE_RELEASED_GEMS'] end gem 'cucumber-expressions', path: ENV['CUCUMBER_EXPRESSIONS_RUBY'] if ENV['CUCUMBER_EXPRESSIONS_RUBY'] - -gem 'gherkin', path: ENV['GHERKIN_RUBY'] if ENV['GHERKIN_RUBY'] - gem 'cucumber-messages', path: ENV['CUCUMBER_MESSAGES_RUBY'] if ENV['CUCUMBER_MESSAGES_RUBY'] - -# Use an older protobuf on JRuby -gem 'google-protobuf', '~> 3.2.0.2' if RUBY_PLATFORM == 'java' +gem 'gherkin', path: ENV['GHERKIN_RUBY'] if ENV['GHERKIN_RUBY'] diff --git a/examples/i18n/Rakefile b/examples/i18n/Rakefile index 78db0bfc92..89395057e5 100644 --- a/examples/i18n/Rakefile +++ b/examples/i18n/Rakefile @@ -4,29 +4,40 @@ task :cucumber do Dir["#{dir}/*"].sort.each do |f| next unless File.directory?(f) lang = f[dir.length + 1..-1] - if examples_working?(lang) - Dir.chdir(f) do - puts "DIR: #{f}" - rake('cucumber') - end - else - STDERR.puts %{ - !!!!! - !!!!! - !!!!! SKIPPING #{lang} (The examples are out of date - please help update them) - !!!!! - !!!!! - } + message = examples_disabled?(lang) + unless message.nil? + STDERR.puts(message) + next + end + + Dir.chdir(f) do + puts "DIR: #{f}" + rake('cucumber') end end end task default: :cucumber +def examples_disabled?(lang) + return make_warning("SKIPPING #{lang} (The examples are out of date - please help update them)") unless examples_working?(lang) + return make_warning('Russian examples have been disabled for JRuby.') if RUBY_PLATFORM == 'java' && lang == 'ru' +end + def examples_working?(lang) !%w[ar].index(lang) end +def make_warning(msg) + %( + !!!!! + !!!!! + !!!!! #{msg} + !!!!! + !!!!! + ) +end + def rake(args) ruby($PROGRAM_NAME, args) end diff --git a/gem_tasks/examples.rake b/gem_tasks/examples.rake index 23e0cff133..c7202e0c30 100644 --- a/gem_tasks/examples.rake +++ b/gem_tasks/examples.rake @@ -1,9 +1,10 @@ # frozen_string_literal: true -desc 'Run all exmples' +desc 'Run all examples' task :examples do Dir['examples/*'].each do |example_dir| next if !File.directory?(example_dir) || %w[examples/tcl].index(example_dir) + puts "Running #{example_dir}" Dir.chdir(example_dir) do raise "No Rakefile in #{Dir.pwd}" unless File.file?('Rakefile') From 4285973ab870e60245f13f469a746fd647529ae6 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 14:18:58 +0100 Subject: [PATCH 05/13] Also disable UK examples for JRuby --- examples/i18n/Rakefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/i18n/Rakefile b/examples/i18n/Rakefile index 89395057e5..0b4fb4774a 100644 --- a/examples/i18n/Rakefile +++ b/examples/i18n/Rakefile @@ -21,7 +21,12 @@ task default: :cucumber def examples_disabled?(lang) return make_warning("SKIPPING #{lang} (The examples are out of date - please help update them)") unless examples_working?(lang) - return make_warning('Russian examples have been disabled for JRuby.') if RUBY_PLATFORM == 'java' && lang == 'ru' + return make_warning("SKIPPING #{lang}: examples have been disabled for JRuby.") if jruby_disabled_examples?(lang) +end + +def jruby_disabled_examples?(lang) + return unless RUBY_PLATFORM == 'java' + return ['ru', 'uk'].include?(lang) end def examples_working?(lang) From af1116103fb224ca860480cdf8b113efef33c299 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 14:39:20 +0100 Subject: [PATCH 06/13] Fix offenses --- examples/i18n/Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/i18n/Rakefile b/examples/i18n/Rakefile index 0b4fb4774a..1693180244 100644 --- a/examples/i18n/Rakefile +++ b/examples/i18n/Rakefile @@ -21,12 +21,12 @@ task default: :cucumber def examples_disabled?(lang) return make_warning("SKIPPING #{lang} (The examples are out of date - please help update them)") unless examples_working?(lang) - return make_warning("SKIPPING #{lang}: examples have been disabled for JRuby.") if jruby_disabled_examples?(lang) + return make_warning("SKIPPING #{lang}: examples have been disabled for JRuby.") if jruby_disabled_examples?(lang) end def jruby_disabled_examples?(lang) return unless RUBY_PLATFORM == 'java' - return ['ru', 'uk'].include?(lang) + %w[uk ru].include?(lang) end def examples_working?(lang) From 18d2bfe406bc51305154f6bad9a6ae300057cfd6 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 15:01:28 +0100 Subject: [PATCH 07/13] Also disable UZ for JRuby i18n examples --- examples/i18n/Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/i18n/Rakefile b/examples/i18n/Rakefile index 1693180244..d73e063286 100644 --- a/examples/i18n/Rakefile +++ b/examples/i18n/Rakefile @@ -26,7 +26,7 @@ end def jruby_disabled_examples?(lang) return unless RUBY_PLATFORM == 'java' - %w[uk ru].include?(lang) + %w[ru uk uz].include?(lang) end def examples_working?(lang) From 73ae38ece25e2122b3f4bc5b400e97e648d6ab68 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 16:27:30 +0100 Subject: [PATCH 08/13] Add descriptions for JRuby limitations --- README.md | 4 ++-- docs/jruby-limitations.md | 40 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 docs/jruby-limitations.md diff --git a/README.md b/README.md index 7fd613dd44..0799c2be4a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ your team. Where to get more info: - * The main website: https://cucumber.io/ + * The main website: https://cucumber.io/ * Documentation: https://cucumber.io/docs * Ruby API Documentation: http://www.rubydoc.info/github/cucumber/cucumber-ruby/ * Support forum: https://groups.google.com/group/cukes @@ -28,7 +28,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber. * Ruby 2.5 * Ruby 2.4 * Ruby 2.3 -* JRuby 9.1 +* JRuby 9.1 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md)) ## Code of Conduct diff --git a/docs/jruby-limitations.md b/docs/jruby-limitations.md new file mode 100644 index 0000000000..35f3250abb --- /dev/null +++ b/docs/jruby-limitations.md @@ -0,0 +1,40 @@ +# Cucumber and JRuby limitations + +`cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), allthough some of the features +are not available on this platform. + +## Defining steps with native languages: + +There are currently three languages (Russian, Ukrainian and Uzbek) for which the step definition +can not be written in native language. +That means, for example, that you can not write the following code: + +```ruby +Допустим('я ввожу число {int}') do |число| + calc.push число +end +``` + +Instead, you have to write: +```ruby +Given('я ввожу число {int}') do |number| + calc.push number +end +``` + +Of course, you can still write your feature files in a native language, for example, the following +feature file can be executed on JRuby: + +```gherkin +# language: ru +Функционал: Сложение чисел + Чтобы не складывать в уме + Все, у кого с этим туго + Хотят автоматическое сложение целых чисел + + Сценарий: Сложение двух целых чисел + Допустим я ввожу число 50 + И затем ввожу число 70 + Если я нажимаю "+" + То результатом должно быть число 120 +``` From 835d7657be0e1ea52a51a6bcf6d5b14f91c1e92f Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 26 Feb 2020 16:31:08 +0100 Subject: [PATCH 09/13] Update docs/jruby-limitations.md Co-Authored-By: Olle Jonsson --- docs/jruby-limitations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jruby-limitations.md b/docs/jruby-limitations.md index 35f3250abb..c37ead85d4 100644 --- a/docs/jruby-limitations.md +++ b/docs/jruby-limitations.md @@ -3,7 +3,7 @@ `cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), allthough some of the features are not available on this platform. -## Defining steps with native languages: +## Defining steps with native languages There are currently three languages (Russian, Ukrainian and Uzbek) for which the step definition can not be written in native language. From a2161050ea1eff08a94cdb58111dac84a031fe4e Mon Sep 17 00:00:00 2001 From: Vincent Date: Wed, 26 Feb 2020 16:31:39 +0100 Subject: [PATCH 10/13] Update docs/jruby-limitations.md Co-Authored-By: Olle Jonsson --- docs/jruby-limitations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/jruby-limitations.md b/docs/jruby-limitations.md index c37ead85d4..e06b88b125 100644 --- a/docs/jruby-limitations.md +++ b/docs/jruby-limitations.md @@ -1,6 +1,6 @@ # Cucumber and JRuby limitations -`cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), allthough some of the features +`cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), although some of the features are not available on this platform. ## Defining steps with native languages From a59ea7fb55e1c6356ea616d3f517bf63a5dc9428 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 16:43:21 +0100 Subject: [PATCH 11/13] Build JRUby 9.1 and 9.2 --- .circleci/config.yml | 16 +++++++++++++--- docs/jruby-limitations.md | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index fc3ec2d239..7b9e63c68d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,14 +77,23 @@ jobs: - build - test - build-jruby: + build-jruby-9.1: + docker: + - image: circleci/jruby:9.1 + + working_directory: ~/repo + steps: + - build + - test + + build-jruby-9.2: docker: - image: circleci/jruby:9.2.8.0 working_directory: ~/repo steps: - build - - test_allow_failure + - test build-ruby-latest: docker: @@ -171,7 +180,8 @@ workflows: - build-ruby-2_5 - build-ruby-2_6 - build-ruby-latest - - build-jruby + - build-jruby-9.1 + - build-jruby-9.2 - build_monorepo - validate-cck: requires: diff --git a/docs/jruby-limitations.md b/docs/jruby-limitations.md index e06b88b125..ca068fbfa1 100644 --- a/docs/jruby-limitations.md +++ b/docs/jruby-limitations.md @@ -1,6 +1,6 @@ # Cucumber and JRuby limitations -`cucumber` can be executed on `JRuby` (tested with `9.2.8.0`), although some of the features +`cucumber` can be executed on `JRuby` (tested with `9.1`and `9.2`), although some of the features are not available on this platform. ## Defining steps with native languages From 86b5d4754af0762a94896ff8672e31a383c64db7 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 16:44:48 +0100 Subject: [PATCH 12/13] Fix CircleCI config --- .circleci/config.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b9e63c68d..3eaf622579 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,7 +77,7 @@ jobs: - build - test - build-jruby-9.1: + build-jruby-9_1: docker: - image: circleci/jruby:9.1 @@ -86,7 +86,7 @@ jobs: - build - test - build-jruby-9.2: + build-jruby-9_2: docker: - image: circleci/jruby:9.2.8.0 @@ -180,8 +180,8 @@ workflows: - build-ruby-2_5 - build-ruby-2_6 - build-ruby-latest - - build-jruby-9.1 - - build-jruby-9.2 + - build-jruby-9_1 + - build-jruby-9_2 - build_monorepo - validate-cck: requires: From 4c834147db3a289152229ad29ca071083028de72 Mon Sep 17 00:00:00 2001 From: Vincent Pretre Date: Wed, 26 Feb 2020 16:59:40 +0100 Subject: [PATCH 13/13] Disable building on JRUby 9.1 as it fails with more languages --- .circleci/config.yml | 10 ---------- README.md | 2 +- docs/jruby-limitations.md | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3eaf622579..2c883019a3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,15 +77,6 @@ jobs: - build - test - build-jruby-9_1: - docker: - - image: circleci/jruby:9.1 - - working_directory: ~/repo - steps: - - build - - test - build-jruby-9_2: docker: - image: circleci/jruby:9.2.8.0 @@ -180,7 +171,6 @@ workflows: - build-ruby-2_5 - build-ruby-2_6 - build-ruby-latest - - build-jruby-9_1 - build-jruby-9_2 - build_monorepo - validate-cck: diff --git a/README.md b/README.md index 0799c2be4a..32959d8b95 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for info on contributing to Cucumber. * Ruby 2.5 * Ruby 2.4 * Ruby 2.3 -* JRuby 9.1 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md)) +* JRuby 9.2 (with [some limitations](https://github.com/cucumber/cucumber-ruby/blob/master/docs/jruby-limitations.md)) ## Code of Conduct diff --git a/docs/jruby-limitations.md b/docs/jruby-limitations.md index ca068fbfa1..72aaa2b416 100644 --- a/docs/jruby-limitations.md +++ b/docs/jruby-limitations.md @@ -1,6 +1,6 @@ # Cucumber and JRuby limitations -`cucumber` can be executed on `JRuby` (tested with `9.1`and `9.2`), although some of the features +`cucumber` can be executed on `JRuby` (tested with `9.2`), although some of the features are not available on this platform. ## Defining steps with native languages