Skip to content

Commit bb5db85

Browse files
authored
Merge pull request #866 from headius/jruby_rakefile_fixes
Small JRuby build fixes
2 parents e809fab + 3d1ed18 commit bb5db85

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
- { os: ubuntu-latest , ruby: 3.4, env: "JSON_DEBUG=1" }
3535
- { os: macos-13, ruby: 3.4 }
3636
- { os: windows-latest , ruby: mswin } # ruby/ruby windows CI
37+
- { os: macos-latest , ruby: jruby-9.4 } # Ruby 3.1
3738
- { os: ubuntu-latest , ruby: jruby-9.4 } # Ruby 3.1
3839
- { os: macos-latest , ruby: truffleruby-head }
3940
- { os: ubuntu-latest , ruby: truffleruby-head }

Rakefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ JAVA_CLASSES = []
9191
JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
9292
JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar")
9393

94+
CLEAN.concat FileList["java/src/**/*.class"]
95+
CLEAN << JRUBY_PARSER_JAR
96+
CLEAN << JRUBY_GENERATOR_JAR
97+
98+
CLOBBER << JAVA_PARSER_SRC
99+
94100
which = lambda { |c|
95101
w = `which #{c}`
96102
break w.chomp unless w.empty?
@@ -140,7 +146,11 @@ if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
140146
classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * path_separator
141147
obj = src.sub(/\.java\Z/, '.class')
142148
file obj => src do
143-
sh 'javac', '-classpath', classpath, '-source', '1.8', '-target', '1.8', src
149+
if File.exist?(File.join(ENV['JAVA_HOME'], "lib", "modules"))
150+
sh 'javac', '-classpath', classpath, '--release', '8', src
151+
else
152+
sh 'javac', '-classpath', classpath, '-source', '1.8', '-target', '1.8', src
153+
end
144154
end
145155
JAVA_CLASSES << obj
146156
end

0 commit comments

Comments
 (0)