summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSatoshi Tagomori <tagomoris@gmail.com>2022-01-22 12:14:26 +0900
committerGitHub <noreply@github.com>2022-01-22 12:14:26 +0900
commit36aad47324dafa08034f9813a11cabf5e1b40229 (patch)
tree54e99b12ef0ebe8b6680cffcbe2c618163bd5792 /lib
parent5df82aa81e04faa46e3139fe179e01b166d662cc (diff)
downloadrake-compiler-36aad47324dafa08034f9813a11cabf5e1b40229.tar.gz
Support --release option to build JRuby extension for older platforms (#201)
Diffstat (limited to 'lib')
-rw-r--r--lib/rake/javaextensiontask.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/rake/javaextensiontask.rb b/lib/rake/javaextensiontask.rb
index baf9c6c..5603afc 100644
--- a/lib/rake/javaextensiontask.rb
+++ b/lib/rake/javaextensiontask.rb
@@ -17,6 +17,9 @@ module Rake
# Generate class files for specific VM version
attr_accessor :target_version
+ # Compile for oldeer platform version
+ attr_accessor :release
+
attr_accessor :encoding
# Specify lint option
@@ -37,6 +40,7 @@ module Rake
@debug = false
@source_version = '1.7'
@target_version = '1.7'
+ @release = nil
@encoding = nil
@java_compiling = nil
@lint_option = nil
@@ -106,8 +110,7 @@ execute the Rake compilation task using the JRuby interpreter.
javac_command_line = [
"javac",
- "-target", @target_version,
- "-source", @source_version,
+ *java_target_args,
java_lint_arg,
"-d", tmp_path,
]
@@ -208,6 +211,14 @@ execute the Rake compilation task using the JRuby interpreter.
end
end
+ def java_target_args
+ if @release
+ ["--release=#{@release}"]
+ else
+ ["-target", @target_version, "-source", @source_version]
+ end
+ end
+
#
# Discover Java Extension Directories and build an extdirs arguments
#