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 {
|
|
|
|
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
|
|
|
output.dir(TEST9_OUT, builtBy: 'cacheTest9')
|
|
|
|
}
|
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 {
|
2021-10-20 18:48:54 -04:00
|
|
|
testImplementation 'org.apache.ant:ant:1.10.12'
|
2021-04-07 17:40:33 -04:00
|
|
|
testImplementation 'org.apache.commons:commons-collections4:4.4'
|
2021-09-28 10:41:05 -04:00
|
|
|
testImplementation 'com.google.guava:guava:31.0.1-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')
|
2021-09-12 16:31:43 -04:00
|
|
|
testImplementation "org.apache.logging.log4j:log4j-slf4j18-impl:${log4jVersion}"
|
2021-10-08 18:02:11 -04:00
|
|
|
testImplementation 'org.apiguardian:apiguardian-api:1.1.2'
|
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"
|
|
|
|
final String OOXML_LITE_REPORT = '../build/ooxml-lite-report'
|
|
|
|
final String OOXML_LITE_JAR = "../build/dist/maven/poi-ooxml-lite/poi-ooxml-lite-${project.version}.jar"
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
task compileTest9(type: JavaCompile) {
|
|
|
|
dependsOn 'compileTestJava', ':poi-ooxml:testJar', ':poi-scratchpad:testJar', ':poi-examples:jar'
|
|
|
|
|
|
|
|
sourceCompatibility = 9
|
|
|
|
targetCompatibility = 9
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
task cacheTest9(type: Copy) {
|
|
|
|
dependsOn 'compileTest9'
|
|
|
|
|
|
|
|
from(file(TEST9_OUT + VERSIONS9))
|
|
|
|
into(TEST9_SRC)
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-08-28 19:48:48 -04:00
|
|
|
task testJar(type: Jar, dependsOn: [ testClasses, cacheTest9 ] ) {
|
2021-04-07 17:40:33 -04:00
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}-tests")
|
|
|
|
|
|
|
|
classifier 'tests'
|
|
|
|
// ignore second module-info.class from main
|
|
|
|
duplicatesStrategy = 'exclude'
|
|
|
|
|
|
|
|
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
|
|
|
|
into('META-INF/versions/9') {
|
|
|
|
from TEST9_SRC include '*.class'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
from sourceSets.test.output + sourceSets.main.output
|
|
|
|
|
|
|
|
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'
|
|
|
|
|
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}",
|
|
|
|
]
|
|
|
|
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
|
|
|
|
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
|
|
|
|
|
|
|
javadoc.onlyIf { false }
|
|
|
|
|
|
|
|
javadocJar.onlyIf { false }
|
|
|
|
|
2021-09-03 17:13:36 -04:00
|
|
|
sourcesJar.onlyIf { false }
|
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
generateMetadataFileForPOIPublication.enabled = false
|