2021-04-07 17:40:33 -04:00
|
|
|
import java.util.regex.Pattern
|
|
|
|
|
|
|
|
/* ====================================================================
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
==================================================================== */
|
|
|
|
|
|
|
|
final String TEST9_SRC = 'src/test/java9'
|
|
|
|
final String TEST9_OUT = "${buildDir}/classes/java9/test/"
|
|
|
|
final String VERSIONS9 = 'META-INF/versions/9'
|
2021-08-29 15:44:37 -04:00
|
|
|
final boolean IBMVM = System.getProperty("java.vendor").contains("IBM")
|
2021-04-07 17:40:33 -04:00
|
|
|
|
2021-04-15 10:25:38 -04:00
|
|
|
configurations {
|
2021-09-23 15:03:06 -04:00
|
|
|
tests
|
2021-09-12 16:31:43 -04:00
|
|
|
misc
|
2021-04-15 10:25:38 -04:00
|
|
|
}
|
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
sourceSets {
|
|
|
|
test {
|
2022-12-27 13:45:15 -05:00
|
|
|
output.dir(TEST9_OUT, builtBy: 'compileTest9')
|
2021-08-29 15:44:37 -04:00
|
|
|
if (IBMVM) {
|
2021-08-29 16:14:19 -04:00
|
|
|
java {
|
|
|
|
exclude '**/HeapDump**'
|
|
|
|
}
|
2021-08-29 15:44:37 -04:00
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-08-30 13:37:58 -04:00
|
|
|
testImplementation 'org.apache.ant:ant:1.10.15'
|
2021-04-07 17:40:33 -04:00
|
|
|
testImplementation 'org.apache.commons:commons-collections4:4.4'
|
2024-08-20 12:29:36 -04:00
|
|
|
testImplementation 'com.google.guava:guava:33.3.0-jre'
|
2021-04-07 17:40:33 -04:00
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
misc(project(':poi-ooxml')) {
|
|
|
|
capabilities {
|
|
|
|
requireCapability("${project.group}:poi-ooxml-rendersign")
|
|
|
|
}
|
2021-09-01 18:32:48 -04:00
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
exclude group: 'org.apache.poi', module: 'poi-scratchpad'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
testCompileOnly project(':poi-scratchpad')
|
|
|
|
testCompileOnly project(path:':poi-scratchpad', configuration:'tests')
|
|
|
|
} else {
|
|
|
|
testImplementation project(':poi-scratchpad')
|
|
|
|
testImplementation project(path:':poi-scratchpad', configuration:'tests')
|
|
|
|
}
|
|
|
|
testImplementation(project(':poi-examples')) {
|
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
exclude group: 'org.apache.poi', module: 'poi-scratchpad'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
testImplementation(project(path:':poi-examples', configuration:'archives')) {
|
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
exclude group: 'org.apache.poi', module: 'poi-scratchpad'
|
|
|
|
}
|
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
testImplementation project(path:':poi', configuration:'tests')
|
2021-09-01 18:32:48 -04:00
|
|
|
testImplementation(project(path:':poi-ooxml', configuration:'tests')) {
|
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
exclude group: 'org.apache.poi', module: 'poi-scratchpad'
|
|
|
|
}
|
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
testImplementation project(path: ':poi-ooxml-lite-agent', configuration: 'archives')
|
2022-09-14 05:31:40 -04:00
|
|
|
testImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:${log4jVersion}"
|
2024-08-11 03:24:06 -04:00
|
|
|
testImplementation 'org.slf4j:slf4j-simple:2.0.16'
|
2021-11-25 05:31:50 -05:00
|
|
|
testRuntimeOnly "org.apiguardian:apiguardian-api:${apiGuardianVersion}"
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
final String MODULE_NAME = 'org.apache.poi.stress'
|
|
|
|
final Pattern MODULE_NOT_REGEX = ~'((poi|poi-scratchpad|poi-ooxml)[/\\\\][^/\\\\]+$|batik-script)'
|
|
|
|
final Pattern MODULE_REGEX = ~'\\.jar$'
|
2021-09-12 16:31:43 -04:00
|
|
|
final List MODULE_COMPILE_PATH = (sourceSets.test.compileClasspath + configurations.misc.files).findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique()
|
|
|
|
final List MODULE_RUNTIME_PATH = (sourceSets.test.runtimeClasspath + configurations.misc.files).findAll{ it.path =~ MODULE_REGEX && !(it.path =~ MODULE_NOT_REGEX) }.collect{ it.parent }.unique()
|
2021-04-07 17:40:33 -04:00
|
|
|
|
|
|
|
final String OOXML_LITE_AGENT = "../build/dist/maven/poi-ooxml-lite-agent/poi-ooxml-lite-agent-${project.version}.jar"
|
2022-03-24 00:42:27 -04:00
|
|
|
final String OOXML_LITE_REPORT = '../src/resources/ooxml-lite-report'
|
2021-04-07 17:40:33 -04:00
|
|
|
final String OOXML_LITE_INCLUDES = "^(com/microsoft/schemas|org/(etsi|openxmlformats|w3/)|org/apache/poi/schemas)"
|
|
|
|
|
|
|
|
task compileTest9(type: JavaCompile) {
|
|
|
|
dependsOn 'compileTestJava', ':poi-ooxml:testJar', ':poi-scratchpad:testJar', ':poi-examples:jar'
|
|
|
|
|
2022-02-21 17:57:03 -05:00
|
|
|
javaCompiler = javaToolchains.compilerFor {
|
2022-12-25 18:56:32 -05:00
|
|
|
languageVersion = JavaLanguageVersion.of(Math.max(11, jdkVersion))
|
2022-02-21 17:57:03 -05:00
|
|
|
}
|
2022-12-25 18:56:32 -05:00
|
|
|
sourceCompatibility = 1.9
|
|
|
|
targetCompatibility = 1.9
|
2021-04-07 17:40:33 -04:00
|
|
|
destinationDirectory = file(TEST9_OUT + VERSIONS9)
|
|
|
|
source = file(TEST9_SRC)
|
|
|
|
options.compilerArgs = [
|
|
|
|
'--patch-module', "${MODULE_NAME}=${(sourceSets.main.output.classesDirs + sourceSets.test.output.classesDirs).asPath}",
|
2021-09-01 18:32:48 -04:00
|
|
|
'--module-path', files(MODULE_COMPILE_PATH).asPath
|
2021-04-07 17:40:33 -04:00
|
|
|
]
|
|
|
|
classpath = files()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
jar {
|
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes('Automatic-Module-Name': MODULE_NAME, 'Multi-Release': 'true')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a separate jar for test-code to depend on it in other projects
|
|
|
|
// See http://stackoverflow.com/questions/5144325/gradle-test-dependency
|
2022-12-27 13:45:15 -05:00
|
|
|
task testJar(type: Jar, dependsOn: [ testClasses, compileTest9 ] ) {
|
2021-04-07 17:40:33 -04:00
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}-tests")
|
|
|
|
|
2023-02-22 15:08:44 -05:00
|
|
|
setArchiveClassifier 'tests'
|
2021-04-07 17:40:33 -04:00
|
|
|
// ignore second module-info.class from main
|
|
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
|
2022-01-22 16:34:35 -05:00
|
|
|
from sourceSets.test.output + sourceSets.main.output
|
2021-04-07 17:40:33 -04:00
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes('Automatic-Module-Name': MODULE_NAME, 'Multi-Release': 'true')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
tests testJar
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
|
|
|
// exclude these from the normal test-run
|
|
|
|
exclude '**/*FileHandler.class'
|
|
|
|
|
|
|
|
dependsOn { testJar }
|
|
|
|
|
2021-08-20 13:07:36 -04:00
|
|
|
systemProperties['junit.jupiter.execution.parallel.enabled'] = 'true'
|
2023-05-11 07:22:19 -04:00
|
|
|
if (jdkVersion == 8) {
|
|
|
|
systemProperties['sun.java2d.renderer'] = 'sun.java2d.marlin.MarlinRenderingEngine'
|
|
|
|
}
|
2021-08-20 13:07:36 -04:00
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
doFirst {
|
2021-05-21 17:22:40 -04:00
|
|
|
jvmArgs += [
|
2021-04-07 17:40:33 -04:00
|
|
|
"-javaagent:${OOXML_LITE_AGENT}=${OOXML_LITE_REPORT}|${OOXML_LITE_INCLUDES}",
|
|
|
|
]
|
2022-02-21 17:57:03 -05:00
|
|
|
if (jdkVersion > 8) {
|
2021-04-07 17:40:33 -04:00
|
|
|
jvmArgs += [
|
|
|
|
'--add-modules', MODULE_NAME,
|
2021-09-01 18:32:48 -04:00
|
|
|
'--module-path', '../build/dist/maven/poi-integration-tests' + File.pathSeparator + files(MODULE_RUNTIME_PATH).asPath,
|
2021-04-07 17:40:33 -04:00
|
|
|
]
|
|
|
|
}
|
2021-09-01 18:32:48 -04:00
|
|
|
if (NO_SCRATCHPAD) {
|
|
|
|
systemProperty 'scratchpad.ignore', 'true'
|
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
}
|
2021-07-19 17:59:38 -04:00
|
|
|
|
2022-09-26 13:44:30 -04:00
|
|
|
javadoc { enabled(false) }
|
2021-07-19 17:59:38 -04:00
|
|
|
|
2022-09-26 13:44:30 -04:00
|
|
|
sourcesJar { enabled(false) }
|
2021-09-03 17:13:36 -04:00
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
generateMetadataFileForPOIPublication.enabled = false
|
2021-11-02 20:00:21 -04:00
|
|
|
publishPOIPublicationToMavenLocal.enabled = false
|