aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml-lite/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'poi-ooxml-lite/build.gradle')
-rw-r--r--poi-ooxml-lite/build.gradle27
1 files changed, 20 insertions, 7 deletions
diff --git a/poi-ooxml-lite/build.gradle b/poi-ooxml-lite/build.gradle
index 1d2dd79efe..90a4abfb4e 100644
--- a/poi-ooxml-lite/build.gradle
+++ b/poi-ooxml-lite/build.gradle
@@ -22,7 +22,7 @@ final String BEANS_RES = "${buildDir}/generated-resources"
sourceSets {
main {
- if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
+ if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
compileClasspath += files(BEANS_RES)
@@ -87,17 +87,26 @@ task compileOoxmlLite(type: Copy) {
java {
- sourceCompatibility = JavaVersion.VERSION_1_8
- targetCompatibility = JavaVersion.VERSION_1_8
+ toolchain {
+ languageVersion.set(JavaLanguageVersion.of(jdkVersion))
+ if (jdkVendor != '') vendor.set(JvmVendorSpec.matching(jdkVendor))
+ }
+}
+
+compileJava {
+ dependsOn 'compileOoxmlLite'
+ options.fork = true
+ options.forkOptions.jvmArgs << '-Xmx2G'
}
processResources.dependsOn 'compileOoxmlLite'
-compileJava.dependsOn 'compileOoxmlLite'
sourcesJar.dependsOn 'compileOoxmlLite'
task compileJava9(type: JavaCompile, dependsOn: 'compileJava') {
- sourceCompatibility = 9
- targetCompatibility = 9
+ javaCompiler = javaToolchains.compilerFor {
+ languageVersion = JavaLanguageVersion.of(jdkVersion)
+ if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
+ }
destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC)
classpath = files()
@@ -107,6 +116,10 @@ task compileJava9(type: JavaCompile, dependsOn: 'compileJava') {
'--module-path', files(MAIN_MODULE_PATH).asPath
]
}
+
+ onlyIf {
+ jdkVersion > 8
+ }
}
task cacheJava9(type: Copy, dependsOn: 'compileJava9') {
@@ -133,7 +146,7 @@ jar {
}
}
- if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
+ if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}