From a2aa1cb3d0de7b7a81253191e9e7e0baa39f0bf4 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Sat, 20 Sep 2025 04:25:34 +0530 Subject: [PATCH 1/3] Add JRuby build output to CLEAN and CLOBBER --- Rakefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Rakefile b/Rakefile index c1768853..64a440db 100644 --- a/Rakefile +++ b/Rakefile @@ -91,6 +91,12 @@ JAVA_CLASSES = [] JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar") JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar") +CLEAN.concat FileList["java/src/**/*.class"] +CLEAN << JRUBY_PARSER_JAR +CLEAN << JRUBY_GENERATOR_JAR + +CLOBBER << JAVA_PARSER_SRC + which = lambda { |c| w = `which #{c}` break w.chomp unless w.empty? From b1cc12605b5b5331b9c6c36774c37464d694b6cd Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Sat, 20 Sep 2025 04:26:03 +0530 Subject: [PATCH 2/3] Use --release flag on Java 9+ The check for the modules dir here indicates whether we are on JDK 9+, since 1.8 did not have modules. Fixes #862. See #859 for some background. --- Rakefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 64a440db..9681be0d 100644 --- a/Rakefile +++ b/Rakefile @@ -146,7 +146,11 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * path_separator obj = src.sub(/\.java\Z/, '.class') file obj => src do - sh 'javac', '-classpath', classpath, '-source', '1.8', '-target', '1.8', src + if File.exist?(File.join(ENV['JAVA_HOME'], "lib", "modules")) + sh 'javac', '-classpath', classpath, '--release', '8', src + else + sh 'javac', '-classpath', classpath, '-source', '1.8', '-target', '1.8', src + end end JAVA_CLASSES << obj end From 3d1ed18b65c7581874ef65a7e197ef7b80b5ae49 Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Sat, 20 Sep 2025 04:37:36 +0530 Subject: [PATCH 3/3] Add macos platform for JRuby CI --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b4070118..b9b6bd96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,7 @@ jobs: - { os: ubuntu-latest , ruby: 3.4, env: "JSON_DEBUG=1" } - { os: macos-13, ruby: 3.4 } - { os: windows-latest , ruby: mswin } # ruby/ruby windows CI + - { os: macos-latest , ruby: jruby-9.4 } # Ruby 3.1 - { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1 - { os: macos-latest , ruby: truffleruby-head } - { os: ubuntu-latest , ruby: truffleruby-head }