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

saxonVersion = '11.2' saxonVersion = '11.2'
apiGuardianVersion = '1.1.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_SRC = 'src/main/java9'
JAVA9_OUT = "${buildDir}/classes/java9/main/" JAVA9_OUT = "${buildDir}/classes/java9/main/"
TEST9_SRC = 'src/test/java9' TEST9_SRC = 'src/test/java9'
options.incremental = true options.incremental = true


onlyIf { 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 { repositories {
mavenCentral() mavenCentral()
maven { maven {
} }


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

doFirst { doFirst {
options { options {
if (JavaVersion.current().isJava9Compatible()) {
addBooleanOption('html5', true)
}
addBooleanOption('html5', true)
addBooleanOption('Xdoclint:all,-missing', true) addBooleanOption('Xdoclint:all,-missing', true)
links 'https://poi.apache.org/apidocs/dev/' links 'https://poi.apache.org/apidocs/dev/'
links 'https://docs.oracle.com/javase/8/docs/api/' links 'https://docs.oracle.com/javase/8/docs/api/'
junitXml.required = true 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 some tests that are not actually tests or do not run cleanly on purpose
exclude '**/BaseTestBorderStyle.class' exclude '**/BaseTestBorderStyle.class'
exclude '**/BaseTestCellUtil.class' exclude '**/BaseTestCellUtil.class'
systemProperties['java.locale.providers'] = 'JRE,CLDR' systemProperties['java.locale.providers'] = 'JRE,CLDR'


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


jvmArgs += [ jvmArgs += [
ignoreFailures = false ignoreFailures = false
suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ] suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ]
// forbiddenapis bundled signatures max supported version is 14 // 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 { forbiddenApisMain {

+ 26
- 14
jenkins/create_jobs.groovy View File

def defaultSlaves = '(ubuntu)&&!beam&&!cloud-slave&&!H29' def defaultSlaves = '(ubuntu)&&!beam&&!cloud-slave&&!H29'


def jdkMapping = [ 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) { static def shellEx(def context, String cmd, def poijob) {
} }
} }
} }
jdk(jdkMapping.get(jdkKey))
jdk(jdkMapping.get(jdkKey).jenkinsJdk)
scm { scm {
if (poijob.githubpr) { if (poijob.githubpr) {
git { git {
switches('-Dsonar.organization=apache') switches('-Dsonar.organization=apache')
switches('-Dsonar.projectKey=poi-parent') switches('-Dsonar.projectKey=poi-parent')
switches('-Dsonar.host.url=https://sonarcloud.io') 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('clean')
tasks('check') tasks('check')
tasks('jacocoTestReport') tasks('jacocoTestReport')
if (poijob.saxonTest) { if (poijob.saxonTest) {
switches('-Psaxon.test=true') switches('-Psaxon.test=true')
} }
switches('-PjdkVersion=${jdkMapping.get(jdkKey).jdkVersion}')
if (jdkMapping.get(jdkKey).jdkVendor != '') {
switches('-PjdkVendor=${jdkMapping.get(jdkKey).jdkVendor}')
}
} }
} else { } else {
ant { ant {
} }
} }
} }
jdk(jdkMapping.get(jdkKey))
jdk(jdkMapping.get(jdkKey).jenkinsJdk)
scm { scm {
svn(xmlbeansSvnBase) { svnNode -> svn(xmlbeansSvnBase) { svnNode ->
svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') / svnNode / browser(class: 'hudson.scm.browsers.ViewSVN') /
switches('-Dsonar.organization=apache') switches('-Dsonar.organization=apache')
switches('-Dsonar.projectKey=apache_xmlbeans') switches('-Dsonar.projectKey=apache_xmlbeans')
switches('-Dsonar.host.url=https://sonarcloud.io') 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('clean')
tasks('jenkins') tasks('jenkins')

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



sourceSets { sourceSets {
main { main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
} }
task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar' 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) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}", '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MODULE_COMPILE_PATH).asPath '--module-path', files(MODULE_COMPILE_PATH).asPath
] ]


onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {


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


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

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



sourceSets { sourceSets {
main { main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
} }
test { test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9') output.dir(TEST9_OUT, builtBy: 'cacheTest9')
} }
} }
task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi-ooxml:jar', ':poi-scratchpad:jar' 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) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}", '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath '--module-path', files(MAIN_MODULE_PATH).asPath
] ]

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) { task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi-ooxml:jar', ':poi-scratchpad:jar' 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) destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC) source = file(TEST9_SRC)
options.compilerArgs = [ options.compilerArgs = [
'--module-path', files(TEST_MODULE_PATH).asPath '--module-path', files(TEST_MODULE_PATH).asPath
] ]
classpath = files() classpath = files()

onlyIf {
jdkVersion > 8
}
} }






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


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from JAVA9_SRC include '*.class' from JAVA9_SRC include '*.class'
} }
// ignore second module-info.class from main // ignore second module-info.class from main
duplicatesStrategy = 'exclude' duplicatesStrategy = 'exclude'


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

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



sourceSets { sourceSets {
test { test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9') output.dir(TEST9_OUT, builtBy: 'cacheTest9')
} }
if (IBMVM) { if (IBMVM) {
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)" final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"


java { 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) { task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi-ooxml:testJar', ':poi-scratchpad:testJar', ':poi-examples:jar' 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) destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC) source = file(TEST9_SRC)
options.compilerArgs = [ options.compilerArgs = [
'--module-path', files(MODULE_COMPILE_PATH).asPath '--module-path', files(MODULE_COMPILE_PATH).asPath
] ]
classpath = files() classpath = files()

onlyIf {
jdkVersion > 8
}
} }




// ignore second module-info.class from main // ignore second module-info.class from main
duplicatesStrategy = 'exclude' duplicatesStrategy = 'exclude'


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from TEST9_SRC include '*.class' from TEST9_SRC include '*.class'
} }
jvmArgs += [ jvmArgs += [
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}", "-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}",
] ]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [ jvmArgs += [
'--add-modules', MODULE_NAME, '--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-integration-tests' + File.pathSeparator + files(MODULE_RUNTIME_PATH).asPath, '--module-path', '../build/dist/maven/poi-integration-tests' + File.pathSeparator + files(MODULE_RUNTIME_PATH).asPath,

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

// TypeSystemHolder.class is in the resources // TypeSystemHolder.class is in the resources
output.dir(BEANS_RES, builtBy: 'generate_beans') output.dir(BEANS_RES, builtBy: 'generate_beans')
compileClasspath += files(BEANS_RES) compileClasspath += files(BEANS_RES)
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
java { java {


compileJava { compileJava {
dependsOn 'generate_beans' dependsOn 'generate_beans'
options.fork = true
options.forkOptions.jvmArgs << '-Xmx2G'
} }


task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava' dependsOn 'compileJava'


sourceCompatibility = 9
targetCompatibility = 9
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(jdkVersion)
if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
}
destinationDirectory = file(JAVA9_OUT + VERSIONS9) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.asPath}", '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath '--module-path', files(MAIN_MODULE_PATH).asPath
] ]

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {
jar { jar {
dependsOn 'sourceJar' dependsOn 'sourceJar'


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

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



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


java { 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) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava' dependsOn 'compileJava'


sourceCompatibility = 9
targetCompatibility = 9
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(jdkVersion)
if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
}
destinationDirectory = file(JAVA9_OUT + VERSIONS9) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--module-path', sourceSets.main.compileClasspath.asPath '--module-path', sourceSets.main.compileClasspath.asPath
] ]
} }

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {
jar { jar {
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}") destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")


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

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



sourceSets { sourceSets {
main { main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
compileClasspath += files(BEANS_RES) compileClasspath += files(BEANS_RES)




java { 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' processResources.dependsOn 'compileOoxmlLite'
compileJava.dependsOn 'compileOoxmlLite'
sourcesJar.dependsOn 'compileOoxmlLite' sourcesJar.dependsOn 'compileOoxmlLite'


task compileJava9(type: JavaCompile, dependsOn: 'compileJava') { 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) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--module-path', files(MAIN_MODULE_PATH).asPath '--module-path', files(MAIN_MODULE_PATH).asPath
] ]
} }

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy, dependsOn: 'compileJava9') { task cacheJava9(type: Copy, dependsOn: 'compileJava9') {
} }
} }


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

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

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


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


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


broken("org.apache.xmlgraphics:batik-script:${batikVersion}"){ broken("org.apache.xmlgraphics:batik-script:${batikVersion}"){
exclude group: 'xalan', module: 'xalan' exclude group: 'xalan', module: 'xalan'
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
exclude group: 'xml-apis', module: 'xml-apis' exclude group: 'xml-apis', module: 'xml-apis'
} }
} }
task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi:jar' 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) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}", '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath '--module-path', files(MAIN_MODULE_PATH).asPath
] ]

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) { task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi:testJar' 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) destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC) source = file(TEST9_SRC)
options.compilerArgs = [ options.compilerArgs = [
'--module-path', files(TEST_MODULE_PATH).asPath '--module-path', files(TEST_MODULE_PATH).asPath
] ]
classpath = files() classpath = files()

onlyIf {
jdkVersion > 8
}
} }




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


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from JAVA9_SRC include '*.class' from JAVA9_SRC include '*.class'
} }
// ignore second module-info.class from main // ignore second module-info.class from main
duplicatesStrategy = 'exclude' duplicatesStrategy = 'exclude'


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from TEST9_SRC include '*.class' from TEST9_SRC include '*.class'
} }
"-XX:ErrorFile=../build/hs_err_pid%p.log", "-XX:ErrorFile=../build/hs_err_pid%p.log",
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}" "-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}"
] ]
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [ jvmArgs += [
'--add-modules', MODULE_NAME, '--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-ooxml-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath, '--module-path', '../build/dist/maven/poi-ooxml-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath,

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



sourceSets { sourceSets {
main { main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
} }
test { test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9') output.dir(TEST9_OUT, builtBy: 'cacheTest9')
} }
} }
task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava', ':poi:jar' 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) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
'--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}", '--patch-module', "${MODULE_NAME}=${sourceSets.main.output.classesDirs.asPath}",
'--module-path', files(MAIN_MODULE_PATH).asPath '--module-path', files(MAIN_MODULE_PATH).asPath
] ]

onlyIf {
jdkVersion > 8
}
} }


task cacheJava9(type: Copy) { task cacheJava9(type: Copy) {
task compileTest9(type: JavaCompile) { task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava', ':poi:jar' 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) destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC) source = file(TEST9_SRC)
options.compilerArgs = [ options.compilerArgs = [
'--module-path', files(TEST_MODULE_PATH).asPath '--module-path', files(TEST_MODULE_PATH).asPath
] ]
classpath = files() classpath = files()

onlyIf {
jdkVersion > 8
}
} }




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


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from JAVA9_SRC include '*.class' from JAVA9_SRC include '*.class'
} }
// ignore second module-info.class from main // ignore second module-info.class from main
duplicatesStrategy = 'exclude' duplicatesStrategy = 'exclude'


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from TEST9_SRC include '*.class' from TEST9_SRC include '*.class'
} }
systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true' systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true'


doFirst { doFirst {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs += [ jvmArgs += [
'--add-modules', MODULE_NAME, '--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-scratchpad-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath, '--module-path', '../build/dist/maven/poi-scratchpad-tests' + File.pathSeparator + files(TEST_MODULE_PATH).asPath,

+ 17
- 9
poi/build.gradle View File



sourceSets { sourceSets {
main { main {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(JAVA9_OUT, builtBy: 'cacheJava9') output.dir(JAVA9_OUT, builtBy: 'cacheJava9')
} }
java { java {
} }
} }
test { test {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
output.dir(TEST9_OUT, builtBy: 'cacheTest9') output.dir(TEST9_OUT, builtBy: 'cacheTest9')
} }
} }
task compileJava9(type: JavaCompile) { task compileJava9(type: JavaCompile) {
dependsOn 'compileJava' dependsOn 'compileJava'


sourceCompatibility = 9
targetCompatibility = 9
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(11)
}
destinationDirectory = file(JAVA9_OUT + VERSIONS9) destinationDirectory = file(JAVA9_OUT + VERSIONS9)
source = file(JAVA9_SRC) source = file(JAVA9_SRC)
classpath = files() classpath = files()
task compileTest9(type: JavaCompile) { task compileTest9(type: JavaCompile) {
dependsOn 'compileTestJava' dependsOn 'compileTestJava'


sourceCompatibility = 9
targetCompatibility = 9
javaCompiler = javaToolchains.compilerFor {
languageVersion = JavaLanguageVersion.of(jdkVersion)
if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
}

destinationDirectory = file(TEST9_OUT + VERSIONS9) destinationDirectory = file(TEST9_OUT + VERSIONS9)
source = file(TEST9_SRC) source = file(TEST9_SRC)
options.compilerArgs = [ options.compilerArgs = [
'--module-path', files(MODULE_PATH).asPath '--module-path', files(MODULE_PATH).asPath
] ]
classpath = files() classpath = files()

onlyIf {
jdkVersion > 8
}
} }




jar { jar {
dependsOn cacheJava9 dependsOn cacheJava9


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from JAVA9_SRC include '*.class' from JAVA9_SRC include '*.class'
} }
// ignore second module-info.class from main // ignore second module-info.class from main
duplicatesStrategy = 'exclude' duplicatesStrategy = 'exclude'


if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
if (jdkVersion == 8) {
into('META-INF/versions/9') { into('META-INF/versions/9') {
from TEST9_SRC include '*.class' from TEST9_SRC include '*.class'
} }
systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true' systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true'


doFirst { doFirst {
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
if (jdkVersion > 8) {
jvmArgs << [ jvmArgs << [
'--add-modules', MODULE_NAME, '--add-modules', MODULE_NAME,
'--module-path', '../build/dist/maven/poi-tests' + File.pathSeparator + files(MODULE_PATH).asPath, '--module-path', '../build/dist/maven/poi-tests' + File.pathSeparator + files(MODULE_PATH).asPath,

Loading…
Cancel
Save