aboutsummaryrefslogtreecommitdiffstats
path: root/poi/build.gradle
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2022-02-21 22:57:03 +0000
committerAndreas Beeker <kiwiwings@apache.org>2022-02-21 22:57:03 +0000
commitb59dbbd0769e154b2c29bad19595904fe181fc48 (patch)
tree059552cc9eb7dd1e56ee1a994f5da95d6bea614c /poi/build.gradle
parenta881c381db69aeb4cf8622c57dfff247fc084c60 (diff)
downloadpoi-b59dbbd0769e154b2c29bad19595904fe181fc48.tar.gz
poi-b59dbbd0769e154b2c29bad19595904fe181fc48.zip
Use gradle toolchain to specify the jdk version and vendor, e.g.
> gradle -no-build-cache -PjdkVersion=16 -PjdkVendor=oracle clean check git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898288 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/build.gradle')
-rw-r--r--poi/build.gradle26
1 files changed, 17 insertions, 9 deletions
diff --git a/poi/build.gradle b/poi/build.gradle
index b2aa41d8bb..3516de3966 100644
--- a/poi/build.gradle
+++ b/poi/build.gradle
@@ -24,7 +24,7 @@ configurations {
sourceSets {
main {
- if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
+ if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
java {
@@ -33,7 +33,7 @@ sourceSets {
}
}
test {
- if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
+ if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
}
}
@@ -93,8 +93,9 @@ final List MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path =~ MO
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava'
- sourceCompatibility = 9
- targetCompatibility = 9
+ javaCompiler = javaToolchains.compilerFor {
+ languageVersion = JavaLanguageVersion.of(11)
+ }
destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC)
classpath = files()
@@ -114,8 +115,11 @@ task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava'
- sourceCompatibility = 9
- targetCompatibility = 9
+ javaCompiler = javaToolchains.compilerFor {
+ languageVersion = JavaLanguageVersion.of(jdkVersion)
+ if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
+ }
+
destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC)
options.compilerArgs = [
@@ -123,6 +127,10 @@ task compileTest9(type: JavaCompile) {
'--module-path', files(MODULE_PATH).asPath
]
classpath = files()
+
+ onlyIf {
+ jdkVersion > 8
+ }
}
@@ -136,7 +144,7 @@ task cacheTest9(type: Copy) {
jar {
dependsOn cacheJava9
- if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
+ if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}
@@ -156,7 +164,7 @@ task testJar(type: Jar, dependsOn: [ testClasses, cacheTest9 ]) {
// ignore second module-info.class from main
duplicatesStrategy = 'exclude'
- if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
+ if (jdkVersion == 8) {
into('META-INF/versions/9') {
from TEST9_SRC include '*.class'
}
@@ -204,7 +212,7 @@ test {
systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true'
doFirst {
- if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
+ if (jdkVersion > 8) {
jvmArgs << [
'--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-tests' + File.pathSeparator + files(MODULE_PATH).asPath,