Browse Source

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
tags/REL_5_2_1
Andreas Beeker 2 years ago
parent
commit
b59dbbd076

+ 22
- 12
build.gradle View File

@@ -128,6 +128,10 @@ subprojects {
saxonVersion = '11.2'
apiGuardianVersion = '1.1.2'

jdkVersion = (project.properties['jdkVersion'] ?: '8') as int
// see https://github.com/gradle/gradle/blob/master/subprojects/jvm-services/src/main/java/org/gradle/internal/jvm/inspection/JvmVendor.java
jdkVendor = (project.properties['jdkVendor'] ?: '') as String

JAVA9_SRC = 'src/main/java9'
JAVA9_OUT = "${buildDir}/classes/java9/main/"
TEST9_SRC = 'src/test/java9'
@@ -155,13 +159,10 @@ subprojects {
options.incremental = true

onlyIf {
(name != "compileJava9" && name != "compileTest9") || JavaVersion.current() != JavaVersion.VERSION_1_8
(name != "compileJava9" && name != "compileTest9") // || jdkVersion > 8
}
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

repositories {
mavenCentral()
maven {
@@ -181,6 +182,10 @@ subprojects {
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
if (jdkVendor != '') vendor.set(JvmVendorSpec.matching(jdkVendor))
}
withJavadocJar()
withSourcesJar()
}
@@ -188,11 +193,13 @@ subprojects {
javadoc {
failOnError = true
maxMemory = "1024M"
javadocTool = javaToolchains.javadocToolFor {
languageVersion = JavaLanguageVersion.of(11)
}

doFirst {
options {
if (JavaVersion.current().isJava9Compatible()) {
addBooleanOption('html5', true)
}
addBooleanOption('html5', true)
addBooleanOption('Xdoclint:all,-missing', true)
links 'https://poi.apache.org/apidocs/dev/'
links 'https://docs.oracle.com/javase/8/docs/api/'
@@ -253,6 +260,11 @@ subprojects {
junitXml.required = true
}

javaLauncher = javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
if (jdkVendor != '') vendor.set(JvmVendorSpec.matching(jdkVendor))
}

// Exclude some tests that are not actually tests or do not run cleanly on purpose
exclude '**/BaseTestBorderStyle.class'
exclude '**/BaseTestCellUtil.class'
@@ -324,14 +336,12 @@ subprojects {
systemProperties['java.locale.providers'] = 'JRE,CLDR'

doFirst {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
// some options were removed in JDK 18
if (JavaVersion.current().ordinal() < JavaVersion.VERSION_18.ordinal()) {
if (jdkVersion < 18) {
jvmArgs += [
'--illegal-access=warn',
]
} else {
System.out.println("Configuring for JDK 18 or higher")
}

jvmArgs += [
@@ -403,7 +413,7 @@ subprojects {
ignoreFailures = false
suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ]
// forbiddenapis bundled signatures max supported version is 14
targetCompatibility = (JavaVersion.VERSION_14.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_14)
// targetCompatibility = (JavaVersion.VERSION_14.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_14)
}

forbiddenApisMain {

+ 26
- 14
jenkins/create_jobs.groovy View File

@@ -141,18 +141,18 @@ def defaultMaven = 'maven_3_latest'
def defaultSlaves = '(ubuntu)&&!beam&&!cloud-slave&&!H29'

def jdkMapping = [
'1.8': 'jdk_1.8_latest',
'1.10': 'jdk_10_latest',
'1.11': 'jdk_11_latest',
'1.12': 'jdk_12_latest',
'1.13': 'jdk_13_latest',
'1.14': 'jdk_14_latest',
'1.15': 'jdk_15_latest',
'1.16': 'jdk_16_latest',
'1.17': 'jdk_17_latest',
'1.18': 'jdk_18_latest',
'OpenJDK 1.8': 'adoptopenjdk_hotspot_8u282',
'IBMJDK': 'ibmjdk_1.8.0_261',
'1.8': [ jenkinsJdk: 'jdk_1.8_latest', jdkVersion: 8, jdkVendor: 'oracle' ],
'1.10': [ jenkinsJdk: 'jdk_10_latest', jdkVersion: 10, jdkVendor: 'oracle' ],
'1.11': [ jenkinsJdk: 'jdk_11_latest', jdkVersion: 11, jdkVendor: 'oracle' ],
'1.12': [ jenkinsJdk: 'jdk_12_latest', jdkVersion: 12, jdkVendor: '' ],
'1.13': [ jenkinsJdk: 'jdk_13_latest', jdkVersion: 13, jdkVendor: '' ],
'1.14': [ jenkinsJdk: 'jdk_14_latest', jdkVersion: 14, jdkVendor: '' ],
'1.15': [ jenkinsJdk: 'jdk_15_latest', jdkVersion: 15, jdkVendor: '' ],
'1.16': [ jenkinsJdk: 'jdk_16_latest', jdkVersion: 16, jdkVendor: '' ],
'1.17': [ jenkinsJdk: 'jdk_17_latest', jdkVersion: 17, jdkVendor: '' ],
'1.18': [ jenkinsJdk: 'jdk_18_latest', jdkVersion: 18, jdkVendor: '' ],
'OpenJDK 1.8': [ jenkinsJdk: 'adoptopenjdk_hotspot_8u282', jdkVersion: 8, jdkVendor: 'adoptopenjdk' ],
'IBMJDK': [ jenkinsJdk: 'ibmjdk_1.8.0_261', jdkVersion: 8, jdkVendor: 'ibm' ]
]

static def shellEx(def context, String cmd, def poijob) {
@@ -302,7 +302,7 @@ poijobs.each { poijob ->
}
}
}
jdk(jdkMapping.get(jdkKey))
jdk(jdkMapping.get(jdkKey).jenkinsJdk)
scm {
if (poijob.githubpr) {
git {
@@ -383,6 +383,10 @@ poijobs.each { poijob ->
switches('-Dsonar.organization=apache')
switches('-Dsonar.projectKey=poi-parent')
switches('-Dsonar.host.url=https://sonarcloud.io')
switches('-PjdkVersion=${jdkMapping.get(jdkKey).jdkVersion}')
if (jdkMapping.get(jdkKey).jdkVendor != '') {
switches('-PjdkVendor=${jdkMapping.get(jdkKey).jdkVendor}')
}
tasks('clean')
tasks('check')
tasks('jacocoTestReport')
@@ -434,6 +438,10 @@ poijobs.each { poijob ->
if (poijob.saxonTest) {
switches('-Psaxon.test=true')
}
switches('-PjdkVersion=${jdkMapping.get(jdkKey).jdkVersion}')
if (jdkMapping.get(jdkKey).jdkVendor != '') {
switches('-PjdkVendor=${jdkMapping.get(jdkKey).jdkVendor}')
}
}
} else {
ant {
@@ -544,7 +552,7 @@ xmlbeansjobs.each { xjob ->
}
}
}
jdk(jdkMapping.get(jdkKey))
jdk(jdkMapping.get(jdkKey).jenkinsJdk)
scm {
svn(xmlbeansSvnBase) { svnNode ->
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
@@ -573,6 +581,10 @@ xmlbeansjobs.each { xjob ->
switches('-Dsonar.organization=apache')
switches('-Dsonar.projectKey=apache_xmlbeans')
switches('-Dsonar.host.url=https://sonarcloud.io')
switches('-PjdkVersion=${jdkMapping.get(jdkKey).jdkVersion}')
if (jdkMapping.get(jdkKey).jdkVendor != '') {
switches('-PjdkVendor=${jdkMapping.get(jdkKey).jdkVendor}')
}
}
tasks('clean')
tasks('jenkins')

+ 12
- 4
poi-examples/build.gradle View File

@@ -19,7 +19,7 @@ import java.util.regex.Pattern

sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
@@ -58,8 +58,11 @@ final List MODULE_COMPILE_PATH = sourceSets.main.compileClasspath.findAll{ it.pa
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'

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()
@@ -67,6 +70,11 @@ task compileJava9(type: JavaCompile) {
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MODULE_COMPILE_PATH).asPath
]


onlyIf {
jdkVersion > 8
}
}

task cacheJava9(type: Copy) {
@@ -81,7 +89,7 @@ jar {

destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}

+ 21
- 9
poi-excelant/build.gradle View File

@@ -23,12 +23,12 @@ configurations {

sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
}
}
@@ -69,8 +69,10 @@ final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlfor
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'

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()
@@ -78,6 +80,10 @@ task compileJava9(type: JavaCompile) {
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath
]

onlyIf {
jdkVersion > 8
}
}

task cacheJava9(type: Copy) {
@@ -90,8 +96,10 @@ task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi-ooxml:jar', ':poi-scratchpad:jar'

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 = [
@@ -99,6 +107,10 @@ task compileTest9(type: JavaCompile) {
'--module-path', files(TEST_MODULE_PATH).asPath
]
classpath = files()

onlyIf {
jdkVersion > 8
}
}


@@ -114,7 +126,7 @@ jar {

destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}
@@ -148,7 +160,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'
}
@@ -172,7 +184,7 @@ test {
jvmArgs += [
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}",
]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [
'--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-excelant-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath,

+ 15
- 7
poi-integration/build.gradle View File

@@ -29,7 +29,7 @@ configurations {

sourceSets {
test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
}
if (IBMVM) {
@@ -98,15 +98,19 @@ final String OOXML_LITE_JAR = "../build/dist/maven/poi-ooxml-lite/poi-ooxml-lite
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
if (jdkVendor != '') vendor.set(JvmVendorSpec.matching(jdkVendor))
}
}

task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi-ooxml:testJar', ':poi-scratchpad:testJar', ':poi-examples:jar'

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 = [
@@ -114,6 +118,10 @@ task compileTest9(type: JavaCompile) {
'--module-path', files(MODULE_COMPILE_PATH).asPath
]
classpath = files()

onlyIf {
jdkVersion > 8
}
}


@@ -141,7 +149,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'
}
@@ -170,7 +178,7 @@ test {
jvmArgs += [
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}",
]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [
'--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-integration-tests' + File.pathSeparator + files(MODULE_RUNTIME_PATH).asPath,

+ 12
- 4
poi-ooxml-full/build.gradle View File

@@ -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'
}

+ 14
- 6
poi-ooxml-lite-agent/build.gradle View File

@@ -17,7 +17,7 @@

sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
@@ -32,15 +32,19 @@ dependencies {
final MODULE_NAME = 'org.apache.poi.ooxml_lite'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
languageVersion.set(JavaLanguageVersion.of(jdkVersion))
if (jdkVendor != '') vendor.set(JvmVendorSpec.matching(jdkVendor))
}
}

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()
@@ -50,6 +54,10 @@ task compileJava9(type: JavaCompile) {
'--module-path', sourceSets.main.compileClasspath.asPath
]
}

onlyIf {
jdkVersion > 8
}
}

task cacheJava9(type: Copy) {
@@ -62,7 +70,7 @@ task cacheJava9(type: Copy) {
jar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}

+ 20
- 7
poi-ooxml-lite/build.gradle View File

@@ -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'
}

+ 30
- 18
poi-ooxml/build.gradle View File

@@ -20,14 +20,14 @@ import java.util.regex.Pattern
configurations {
runtimeClasspath {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}

compileClasspath {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
@@ -39,12 +39,12 @@ configurations {

sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
}
}
@@ -87,19 +87,19 @@ dependencies {
renderImplementation "org.apache.xmlgraphics:batik-svggen:${batikVersion}"
renderImplementation("org.apache.xmlgraphics:batik-svgrasterizer:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
renderImplementation("org.apache.xmlgraphics:batik-codec:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
renderImplementation("org.apache.xmlgraphics:batik-bridge:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
@@ -109,19 +109,19 @@ dependencies {
rendersignImplementation "org.apache.xmlgraphics:batik-svggen:${batikVersion}"
rendersignImplementation("org.apache.xmlgraphics:batik-svgrasterizer:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
rendersignImplementation("org.apache.xmlgraphics:batik-codec:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
rendersignImplementation("org.apache.xmlgraphics:batik-bridge:${batikVersion}") {
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
@@ -153,7 +153,7 @@ dependencies {

broken("org.apache.xmlgraphics:batik-script:${batikVersion}"){
exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis'
}
}
@@ -179,8 +179,10 @@ compileJava {
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi:jar'

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()
@@ -188,6 +190,10 @@ task compileJava9(type: JavaCompile) {
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath
]

onlyIf {
jdkVersion > 8
}
}

task cacheJava9(type: Copy) {
@@ -200,8 +206,10 @@ task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi:testJar'

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 = [
@@ -209,6 +217,10 @@ task compileTest9(type: JavaCompile) {
'--module-path', files(TEST_MODULE_PATH).asPath
]
classpath = files()

onlyIf {
jdkVersion > 8
}
}


@@ -222,7 +234,7 @@ task cacheTest9(type: Copy) {
jar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}
@@ -242,7 +254,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
// 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'
}
@@ -321,7 +333,7 @@ test {
"-XX:ErrorFile=../build/hs_err_pid%p.log",
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}"
]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [
'--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-ooxml-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath,

+ 21
- 9
poi-scratchpad/build.gradle View File

@@ -24,12 +24,12 @@ configurations {

sourceSets {
main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
}
}
test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
}
}
@@ -64,8 +64,10 @@ final List TEST_MODULE_PATH = sourceSets.test.runtimeClasspath.findAll{ it.path
task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi:jar'

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()
@@ -73,6 +75,10 @@ task compileJava9(type: JavaCompile) {
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath
]

onlyIf {
jdkVersion > 8
}
}

task cacheJava9(type: Copy) {
@@ -85,8 +91,10 @@ task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi:jar'

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 = [
@@ -94,6 +102,10 @@ task compileTest9(type: JavaCompile) {
'--module-path', files(TEST_MODULE_PATH).asPath
]
classpath = files()

onlyIf {
jdkVersion > 8
}
}


@@ -107,7 +119,7 @@ task cacheTest9(type: Copy) {
jar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")

if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') {
from JAVA9_SRC include '*.class'
}
@@ -127,7 +139,7 @@ task testJar(type: Jar, dependsOn: testClasses) {
// 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'
}
@@ -176,7 +188,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-scratchpad-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath,

+ 17
- 9
poi/build.gradle View File

@@ -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,

Loading…
Cancel
Save