diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2022-02-21 22:57:03 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2022-02-21 22:57:03 +0000 |
commit | b59dbbd0769e154b2c29bad19595904fe181fc48 (patch) | |
tree | 059552cc9eb7dd1e56ee1a994f5da95d6bea614c /poi-ooxml-full | |
parent | a881c381db69aeb4cf8622c57dfff247fc084c60 (diff) | |
download | poi-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-ooxml-full')
-rw-r--r-- | poi-ooxml-full/build.gradle | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/poi-ooxml-full/build.gradle b/poi-ooxml-full/build.gradle index 1a8e91e638..513720a722 100644 --- a/poi-ooxml-full/build.gradle +++ b/poi-ooxml-full/build.gradle @@ -26,7 +26,7 @@ sourceSets { // TypeSystemHolder.class is in the resources output.dir(BEANS_RES, builtBy: 'generate_beans') compileClasspath += files(BEANS_RES) - if (JavaVersion.current() != JavaVersion.VERSION_1_8) { + if (jdkVersion > 8) { output.dir(JAVA9_OUT, builtBy: 'cacheJava9') } java { @@ -52,13 +52,17 @@ final List MAIN_MODULE_PATH = sourceSets.main.runtimeClasspath.findAll{ it.path compileJava { dependsOn 'generate_beans' + options.fork = true + options.forkOptions.jvmArgs << '-Xmx2G' } 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() @@ -66,6 +70,10 @@ task compileJava9(type: JavaCompile) { '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.asPath}", '--module-path', files(MAIN_MODULE_PATH).asPath ] + + onlyIf { + jdkVersion > 8 + } } task cacheJava9(type: Copy) { @@ -136,7 +144,7 @@ task sourceJar(type: Jar) { jar { dependsOn 'sourceJar' - if (JavaVersion.current() == JavaVersion.VERSION_1_8) { + if (jdkVersion == 8) { into('META-INF/versions/9') { from JAVA9_SRC include '*.class' } |