2016-09-22 05:21:56 -04:00
|
|
|
/* ====================================================================
|
|
|
|
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.
|
|
|
|
==================================================================== */
|
2021-05-21 17:22:40 -04:00
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
import org.w3c.dom.Node
|
|
|
|
import org.w3c.dom.NodeList
|
|
|
|
|
|
|
|
import javax.xml.xpath.XPath
|
|
|
|
import javax.xml.xpath.XPathConstants
|
|
|
|
import javax.xml.xpath.XPathFactory
|
|
|
|
|
2016-10-14 16:46:30 -04:00
|
|
|
buildscript {
|
2018-06-07 01:58:10 -04:00
|
|
|
repositories {
|
2021-07-19 17:59:38 -04:00
|
|
|
maven { url 'https://plugins.gradle.org/m2/' }
|
2021-05-21 18:32:09 -04:00
|
|
|
mavenCentral()
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
2016-10-14 16:46:30 -04:00
|
|
|
}
|
2016-09-22 05:21:56 -04:00
|
|
|
|
2021-03-28 15:54:57 -04:00
|
|
|
plugins {
|
2021-04-07 17:40:33 -04:00
|
|
|
id 'base'
|
2023-08-05 10:42:47 -04:00
|
|
|
id 'com.dorongold.task-tree' version '2.1.1'
|
2024-01-30 16:01:49 -05:00
|
|
|
id 'org.nosphere.apache.rat' version '0.8.1'
|
2021-07-19 17:59:38 -04:00
|
|
|
id 'distribution'
|
2024-11-05 14:46:19 -05:00
|
|
|
id "com.github.spotbugs" version '6.0.26'
|
2024-10-15 13:21:27 -04:00
|
|
|
id 'de.thetaphi.forbiddenapis' version '3.8'
|
2023-05-28 06:37:22 -04:00
|
|
|
id 'org.sonarqube' version '4.0.0.2929'
|
2024-08-20 12:26:58 -04:00
|
|
|
id 'org.cyclonedx.bom' version '1.10.0'
|
2023-03-22 19:12:28 -04:00
|
|
|
id 'com.adarshr.test-logger' version '3.2.0'
|
2021-03-28 15:54:57 -04:00
|
|
|
}
|
|
|
|
|
2018-06-30 16:40:53 -04:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2024-05-26 17:42:46 -04:00
|
|
|
// maven { url 'https://repository.apache.org/content/repositories/staging' }
|
2018-06-30 16:40:53 -04:00
|
|
|
}
|
|
|
|
|
2017-09-15 14:39:18 -04:00
|
|
|
// Only add the plugin for Sonar if enabled
|
2017-03-10 15:13:46 -05:00
|
|
|
if (project.hasProperty('enableSonar')) {
|
2018-06-07 01:58:10 -04:00
|
|
|
println 'Enabling Sonar support'
|
2021-07-19 17:59:38 -04:00
|
|
|
apply plugin: 'org.sonarqube'
|
2017-03-10 15:13:46 -05:00
|
|
|
}
|
2016-12-26 15:47:29 -05:00
|
|
|
|
2023-09-28 21:01:46 -04:00
|
|
|
boolean isCIBuild = false
|
2023-09-28 21:16:35 -04:00
|
|
|
String dateSuffix = new Date().format('yyyyMMdd')
|
2021-11-07 09:59:48 -05:00
|
|
|
|
2016-09-22 05:21:56 -04:00
|
|
|
// For help converting an Ant build to a Gradle build, see
|
|
|
|
// https://docs.gradle.org/current/userguide/ant.html
|
|
|
|
|
2018-06-30 16:36:47 -04:00
|
|
|
configurations {
|
2020-12-25 14:19:32 -05:00
|
|
|
antLibs {
|
|
|
|
attributes {
|
|
|
|
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
|
|
|
|
}
|
|
|
|
}
|
2018-06-30 16:36:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2024-10-21 13:04:23 -04:00
|
|
|
antLibs("org.junit.jupiter:junit-jupiter:5.11.3")
|
2024-08-30 13:37:58 -04:00
|
|
|
antLibs("org.apache.ant:ant-junitlauncher:1.10.15")
|
2018-06-30 16:36:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
ant.taskdef(name: "junit",
|
2020-12-25 14:19:32 -05:00
|
|
|
classname: "org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask",
|
2018-06-30 16:36:47 -04:00
|
|
|
classpath: configurations.antLibs.asPath)
|
|
|
|
|
2021-04-18 18:11:26 -04:00
|
|
|
|
2019-10-26 01:26:56 -04:00
|
|
|
wrapper {
|
2024-10-26 11:38:16 -04:00
|
|
|
gradleVersion = '8.10.2'
|
2019-10-26 01:26:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task adjustWrapperPropertiesFile {
|
2020-05-27 16:27:38 -04:00
|
|
|
doLast {
|
|
|
|
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
|
|
|
|
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties')
|
|
|
|
}
|
|
|
|
new File(project.projectDir, 'gradle/wrapper/gradle-wrapper.properties').with { it.text = it.readLines().findAll { it }.sort().join('\n') }
|
|
|
|
ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
|
|
|
|
}
|
2019-10-26 01:26:56 -04:00
|
|
|
}
|
|
|
|
wrapper.finalizedBy adjustWrapperPropertiesFile
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2022-09-02 09:23:03 -04:00
|
|
|
group = 'org.apache.poi'
|
|
|
|
|
2016-10-07 15:33:11 -04:00
|
|
|
/**
|
2020-05-27 16:27:38 -04:00
|
|
|
Define properties for all projects, including this one
|
|
|
|
*/
|
2016-10-07 15:33:11 -04:00
|
|
|
allprojects {
|
2021-04-18 18:11:26 -04:00
|
|
|
// apply plugin: 'eclipse'
|
2021-09-23 15:03:06 -04:00
|
|
|
apply plugin: 'idea'
|
2022-09-02 09:23:03 -04:00
|
|
|
|
2024-11-08 03:52:52 -05:00
|
|
|
version = '5.4.0'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-05-27 16:27:38 -04:00
|
|
|
Define things that are only necessary in sub-projects, but not in the master-project itself
|
|
|
|
*/
|
2016-10-07 15:33:11 -04:00
|
|
|
subprojects {
|
|
|
|
//Put instructions for each sub project, but not the master
|
2021-03-14 16:43:43 -04:00
|
|
|
apply plugin: 'java-library'
|
2016-10-07 15:33:11 -04:00
|
|
|
apply plugin: 'jacoco'
|
2021-04-07 17:40:33 -04:00
|
|
|
apply plugin: 'maven-publish'
|
2021-05-21 17:22:40 -04:00
|
|
|
apply plugin: 'signing'
|
2021-05-21 18:32:09 -04:00
|
|
|
apply plugin: 'de.thetaphi.forbiddenapis'
|
2021-08-25 19:07:06 -04:00
|
|
|
apply plugin: 'com.github.spotbugs'
|
2022-12-21 06:23:43 -05:00
|
|
|
apply plugin: 'org.cyclonedx.bom'
|
2023-03-22 19:12:28 -04:00
|
|
|
apply plugin: 'com.adarshr.test-logger'
|
2016-10-14 16:46:30 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
ext {
|
2024-10-30 10:54:04 -04:00
|
|
|
bouncyCastleVersion = '1.79'
|
2024-07-16 10:11:35 -04:00
|
|
|
commonsCodecVersion = '1.17.1'
|
2024-08-20 12:28:30 -04:00
|
|
|
commonsCompressVersion = '1.27.1'
|
2024-09-19 07:15:42 -04:00
|
|
|
commonsIoVersion = '2.17.0'
|
2020-02-14 18:00:49 -05:00
|
|
|
commonsMathVersion = '3.6.1'
|
2024-10-21 13:04:23 -04:00
|
|
|
junitVersion = '5.11.3'
|
2024-09-30 07:40:58 -04:00
|
|
|
log4jVersion = '2.24.1'
|
2022-12-28 12:46:55 -05:00
|
|
|
mockitoVersion = '4.11.0'
|
2024-08-01 11:46:30 -04:00
|
|
|
hamcrestVersion = '3.0'
|
2024-11-05 05:38:30 -05:00
|
|
|
xmlbeansVersion = '5.2.2'
|
2024-10-09 16:47:24 -04:00
|
|
|
batikVersion = '1.18'
|
2024-05-13 11:49:36 -04:00
|
|
|
graphics2dVersion = '3.0.2'
|
2024-08-09 12:03:15 -04:00
|
|
|
pdfboxVersion = '3.0.3'
|
2024-07-02 16:29:26 -04:00
|
|
|
saxonVersion = '12.5'
|
2024-11-05 14:17:51 -05:00
|
|
|
xmlSecVersion = '3.0.5'
|
2021-11-25 05:31:50 -05:00
|
|
|
apiGuardianVersion = '1.1.2'
|
2021-05-13 08:11:35 -04:00
|
|
|
|
2022-02-21 17:57:03 -05:00
|
|
|
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
|
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
JAVA9_SRC = 'src/main/java9'
|
|
|
|
JAVA9_OUT = "${buildDir}/classes/java9/main/"
|
|
|
|
TEST9_SRC = 'src/test/java9'
|
|
|
|
TEST9_OUT = "${buildDir}/classes/java9/test/"
|
|
|
|
VERSIONS9 = 'META-INF/versions/9'
|
2021-09-01 18:32:48 -04:00
|
|
|
|
|
|
|
NO_SCRATCHPAD = (findProperty("scratchpad.ignore") == "true")
|
2021-11-25 05:05:00 -05:00
|
|
|
SAXON_TEST = (findProperty("saxon.test") == "true")
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
configurations {
|
|
|
|
all {
|
|
|
|
resolutionStrategy {
|
|
|
|
force "commons-io:commons-io:${commonsIoVersion}"
|
2024-08-11 03:24:06 -04:00
|
|
|
force 'org.slf4j:slf4j-api:2.0.16'
|
2024-10-23 15:18:51 -04:00
|
|
|
force 'com.fasterxml.woodstox:woodstox-core:7.1.0'
|
2021-09-12 16:31:43 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.encoding = 'UTF-8'
|
2023-02-22 17:43:41 -05:00
|
|
|
options.compilerArgs += '-Xlint:unchecked'
|
2021-05-13 20:37:50 -04:00
|
|
|
options.deprecation = true
|
2021-11-07 09:59:48 -05:00
|
|
|
options.incremental = true
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
2023-05-11 09:54:55 -04:00
|
|
|
tasks.withType(Test) {
|
|
|
|
systemProperty "file.encoding", "UTF-8"
|
|
|
|
}
|
|
|
|
tasks.withType(Javadoc) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
}
|
2023-06-12 06:10:37 -04:00
|
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
|
|
|
preserveFileTimestamps = false
|
|
|
|
reproducibleFileOrder = true
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
|
|
|
repositories {
|
2019-03-21 05:38:21 -04:00
|
|
|
mavenCentral()
|
2024-05-26 17:42:46 -04:00
|
|
|
// maven { url 'https://repository.apache.org/content/repositories/staging' }
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
2021-01-03 13:19:55 -05:00
|
|
|
dependencies {
|
2021-03-14 16:43:43 -04:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter:${junitVersion}"
|
|
|
|
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
|
|
|
|
testImplementation "org.hamcrest:hamcrest:${hamcrestVersion}"
|
|
|
|
testImplementation "org.apache.logging.log4j:log4j-core:${log4jVersion}"
|
2023-01-06 14:58:45 -05:00
|
|
|
|
|
|
|
if (SAXON_TEST) {
|
|
|
|
testRuntimeOnly("net.sf.saxon:Saxon-HE:${saxonVersion}") {
|
|
|
|
exclude group: 'xml-apis', module: 'xml-apis'
|
|
|
|
}
|
|
|
|
}
|
2021-01-03 13:19:55 -05:00
|
|
|
}
|
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
java {
|
2022-02-21 17:57:03 -05:00
|
|
|
toolchain {
|
2023-02-22 15:31:47 -05:00
|
|
|
languageVersion = JavaLanguageVersion.of(jdkVersion)
|
|
|
|
if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
|
2022-02-21 17:57:03 -05:00
|
|
|
}
|
2021-05-21 17:22:40 -04:00
|
|
|
withJavadocJar()
|
|
|
|
withSourcesJar()
|
|
|
|
}
|
|
|
|
|
|
|
|
javadoc {
|
|
|
|
failOnError = true
|
|
|
|
maxMemory = "1024M"
|
2022-02-21 17:57:03 -05:00
|
|
|
javadocTool = javaToolchains.javadocToolFor {
|
2022-10-28 19:10:54 -04:00
|
|
|
languageVersion = JavaLanguageVersion.of(jdkVersion)
|
2022-02-21 17:57:03 -05:00
|
|
|
}
|
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
doFirst {
|
|
|
|
options {
|
2022-10-29 05:12:37 -04:00
|
|
|
if (jdkVersion > 8) addBooleanOption('html5', true)
|
2021-05-21 17:22:40 -04:00
|
|
|
addBooleanOption('Xdoclint:all,-missing', true)
|
|
|
|
links 'https://poi.apache.org/apidocs/dev/'
|
|
|
|
links 'https://docs.oracle.com/javase/8/docs/api/'
|
|
|
|
links 'https://xmlbeans.apache.org/docs/5.0.0/'
|
2022-07-18 06:37:33 -04:00
|
|
|
links 'https://commons.apache.org/proper/commons-compress/apidocs/'
|
2021-05-21 17:22:40 -04:00
|
|
|
use = true
|
|
|
|
splitIndex = true
|
|
|
|
source = "1.8"
|
|
|
|
}
|
|
|
|
}
|
2022-06-16 10:52:45 -04:00
|
|
|
}
|
2022-03-24 00:42:30 -04:00
|
|
|
|
2022-06-16 10:52:45 -04:00
|
|
|
// helper-target to get a directory with all third-party libraries
|
|
|
|
// this is used for mass-regression-testing
|
|
|
|
task getDeps(type: Copy) {
|
|
|
|
from sourceSets.main.runtimeClasspath
|
|
|
|
into 'build/runtime/'
|
2021-05-21 17:22:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType(Jar) {
|
|
|
|
duplicatesStrategy = 'fail'
|
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
|
|
|
|
|
|
|
|
doLast {
|
2024-01-23 04:28:17 -05:00
|
|
|
// make sure we do not have distribution jar-files with different versions
|
|
|
|
// in the build-dir as those lead to strange errors about "duplicate modules"
|
|
|
|
// when building java9 JPMS class files ("java9")
|
|
|
|
ant.delete(failOnError: true, verbose: true) {
|
2024-01-26 07:52:16 -05:00
|
|
|
fileset(dir: "../build/dist/maven/${project.archivesBaseName}", erroronmissingdir: false) {
|
2024-01-23 04:28:17 -05:00
|
|
|
include(name: '*.jar')
|
|
|
|
exclude(name: "*${version}.jar")
|
|
|
|
exclude(name: "*${version}-sources.jar")
|
|
|
|
|
|
|
|
include(name: '*.jar.asc')
|
|
|
|
exclude(name: "*${version}.jar.asc")
|
|
|
|
exclude(name: "*${version}-sources.jar.asc")
|
|
|
|
|
|
|
|
include(name: '*.jar.sha256')
|
|
|
|
exclude(name: "*${version}.jar.sha256")
|
|
|
|
exclude(name: "*${version}-sources.jar.sha256")
|
|
|
|
|
|
|
|
include(name: '*.jar.sha512')
|
|
|
|
exclude(name: "*${version}.jar.sha512")
|
|
|
|
exclude(name: "*${version}-sources.jar.sha512")
|
|
|
|
|
|
|
|
include(name: '*.pom')
|
|
|
|
exclude(name: "*${version}.pom")
|
|
|
|
|
|
|
|
include(name: '*.pom.asc')
|
|
|
|
exclude(name: "*${version}.pom.asc")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// use failOnError=false for -javadoc and -tests as not all modules create this directory
|
|
|
|
ant.delete(failOnError: false, verbose: true) {
|
2024-01-26 07:52:16 -05:00
|
|
|
fileset(dir: "../build/dist/maven/${project.archivesBaseName}-javadoc", erroronmissingdir: false) {
|
2024-01-23 04:28:17 -05:00
|
|
|
include(name: '*-javadoc.jar')
|
|
|
|
exclude(name: "*${version}-javadoc.jar")
|
|
|
|
|
|
|
|
include(name: '*-javadoc.jar.asc')
|
|
|
|
exclude(name: "*${version}-javadoc.jar.asc")
|
|
|
|
|
|
|
|
include(name: '*-javadoc.jar.sha256')
|
|
|
|
exclude(name: "*${version}-javadoc.jar.sha256")
|
|
|
|
|
|
|
|
include(name: '*-javadoc.jar.sha512')
|
|
|
|
exclude(name: "*${version}-javadoc.jar.sha512")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ant.delete(failOnError: false, verbose: true) {
|
2024-01-26 07:52:16 -05:00
|
|
|
fileset(dir: "../build/dist/maven/${project.archivesBaseName}-tests", erroronmissingdir: false) {
|
2024-01-23 04:28:17 -05:00
|
|
|
include(name: '*-tests.jar')
|
|
|
|
exclude(name: "*${version}-tests.jar")
|
|
|
|
|
|
|
|
include(name: '*-tests.jar.asc')
|
|
|
|
exclude(name: "*${version}-tests.jar.asc")
|
|
|
|
|
|
|
|
include(name: '*-tests.jar.sha256')
|
|
|
|
exclude(name: "*${version}-tests.jar.sha256")
|
|
|
|
|
|
|
|
include(name: '*-tests.jar.sha512')
|
|
|
|
exclude(name: "*${version}-tests.jar.sha512")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
ant.checksum(file: it.archivePath, algorithm: 'SHA-256', fileext: '.sha256', format: 'MD5SUM')
|
|
|
|
ant.checksum(file: it.archivePath, algorithm: 'SHA-512', fileext: '.sha512', format: 'MD5SUM')
|
|
|
|
}
|
2021-04-18 18:11:26 -04:00
|
|
|
}
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
jar {
|
2021-09-12 16:31:43 -04:00
|
|
|
from("../legal") {
|
|
|
|
include "NOTICE"
|
|
|
|
include "LICENSE"
|
|
|
|
}
|
|
|
|
|
|
|
|
rename('^(NOTICE|LICENSE)', 'META-INF/$1')
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
manifest {
|
2021-09-12 16:31:43 -04:00
|
|
|
attributes(
|
|
|
|
'Specification-Title': 'Apache POI',
|
|
|
|
'Specification-Version': project.version,
|
|
|
|
'Specification-Vendor': 'The Apache Software Foundation',
|
|
|
|
'Implementation-Title': 'Apache POI',
|
|
|
|
'Implementation-Version': project.version,
|
|
|
|
'Implementation-Vendor': 'org.apache.poi',
|
|
|
|
'Implementation-Vendor-Id': 'The Apache Software Foundation'
|
|
|
|
)
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
javadocJar {
|
|
|
|
// if javadocs and binaries are in the same directory, JPMS complaints about duplicated modules
|
|
|
|
// in the module-path
|
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}-javadoc")
|
|
|
|
}
|
|
|
|
|
|
|
|
sourcesJar {
|
|
|
|
destinationDirectory = file("../build/dist/maven/${project.archivesBaseName}")
|
|
|
|
exclude 'META-INF/services/**'
|
|
|
|
}
|
|
|
|
|
2016-10-07 15:33:11 -04:00
|
|
|
test {
|
2024-02-20 17:48:53 -05:00
|
|
|
// use US locale for tests
|
|
|
|
systemProperty "user.language", "en"
|
|
|
|
systemProperty "user.country", "US"
|
|
|
|
|
2021-01-03 12:02:24 -05:00
|
|
|
// make XML test-results available for Jenkins CI
|
|
|
|
useJUnitPlatform()
|
|
|
|
reports {
|
2021-08-28 19:48:48 -04:00
|
|
|
junitXml.required = true
|
2021-01-03 12:02:24 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 17:57:03 -05:00
|
|
|
javaLauncher = javaToolchains.launcherFor {
|
2023-02-22 15:31:47 -05:00
|
|
|
languageVersion = JavaLanguageVersion.of(jdkVersion)
|
|
|
|
if (jdkVendor != '') vendor = JvmVendorSpec.matching(jdkVendor)
|
2022-02-21 17:57:03 -05:00
|
|
|
}
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
// Exclude some tests that are not actually tests or do not run cleanly on purpose
|
|
|
|
exclude '**/BaseTestBorderStyle.class'
|
|
|
|
exclude '**/BaseTestCellUtil.class'
|
|
|
|
exclude '**/TestUnfixedBugs.class'
|
|
|
|
exclude '**/TestOneFile.class'
|
2020-09-09 03:05:56 -04:00
|
|
|
|
2018-08-23 16:23:30 -04:00
|
|
|
// Exclude Test Suites
|
|
|
|
exclude '**/All*Tests.class'
|
|
|
|
exclude '**/HSSFTests.class'
|
|
|
|
|
2016-10-07 15:33:11 -04:00
|
|
|
// set heap size for the test JVM(s)
|
|
|
|
minHeapSize = "128m"
|
2023-03-25 21:08:13 -04:00
|
|
|
maxHeapSize = "2g"
|
2021-11-07 09:59:48 -05:00
|
|
|
|
2018-02-08 14:34:22 -05:00
|
|
|
|
|
|
|
// Specifying the local via system properties did not work, so we set them this way
|
2023-02-22 15:08:44 -05:00
|
|
|
jvmArgs += [
|
2021-05-21 17:22:40 -04:00
|
|
|
'-Djava.awt.headless=true',
|
|
|
|
'-Djavax.xml.stream.XMLInputFactory=com.sun.xml.internal.stream.XMLInputFactoryImpl',
|
|
|
|
"-Dversion.id=${project.version}",
|
|
|
|
'-ea',
|
|
|
|
// -Xjit:verbose={compileStart|compileEnd},vlog=build/jit.log${no.jit.sherlock} ... if ${isIBMVM}
|
|
|
|
]
|
2020-02-13 18:26:54 -05:00
|
|
|
|
2021-11-07 09:59:48 -05:00
|
|
|
// detect if running on Jenkins/CI
|
|
|
|
isCIBuild |= Boolean.valueOf(System.getenv("CI_BUILD"));
|
|
|
|
|
|
|
|
if (isCIBuild) {
|
2021-12-06 10:00:06 -05:00
|
|
|
System.out.println("Run with reduced parallelism for CI build");
|
|
|
|
|
|
|
|
jvmArgs += [
|
|
|
|
// Strictly serial
|
2023-03-22 19:12:28 -04:00
|
|
|
'-Djunit.jupiter.execution.parallel.enabled=false',
|
2021-12-06 10:00:06 -05:00
|
|
|
|
|
|
|
// OR parallel on 2 threads
|
2023-03-22 19:12:28 -04:00
|
|
|
//'-Djunit.jupiter.execution.parallel.config.strategy=fixed',
|
|
|
|
//'-Djunit.jupiter.execution.parallel.config.fixed.parallelism=2'
|
2021-12-06 10:00:06 -05:00
|
|
|
]
|
|
|
|
maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
|
|
|
} else {
|
|
|
|
jvmArgs += [
|
|
|
|
'-Djunit.jupiter.execution.parallel.enabled=true',
|
|
|
|
'-Djunit.jupiter.execution.parallel.config.strategy=dynamic',
|
2021-11-07 09:59:48 -05:00
|
|
|
|
|
|
|
// this setting breaks the test builds, do not use it!
|
2021-12-06 10:00:06 -05:00
|
|
|
//'-Djunit.jupiter.execution.parallel.mode.default=concurrent'
|
|
|
|
]
|
2021-11-07 09:59:48 -05:00
|
|
|
|
2021-12-06 10:00:06 -05:00
|
|
|
// Explicitly defining the maxParallelForks was always slower than not setting it
|
|
|
|
// So we leave this to Gradle itself, which seems to be very smart
|
|
|
|
// maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1
|
|
|
|
// maxParallelForks = Math.max( Runtime.runtime.availableProcessors() - 1, 1 )
|
2021-11-07 09:59:48 -05:00
|
|
|
}
|
|
|
|
|
2016-10-07 15:33:11 -04:00
|
|
|
// show standard out and standard error of the test JVM(s) on the console
|
|
|
|
//testLogging.showStandardStreams = true
|
|
|
|
|
|
|
|
// http://forums.gradle.org/gradle/topics/jacoco_related_failure_in_multiproject_build
|
|
|
|
systemProperties['user.dir'] = workingDir
|
2022-01-10 17:06:26 -05:00
|
|
|
systemProperties['java.io.tmpdir'] = 'build'
|
2020-02-13 18:26:54 -05:00
|
|
|
|
2021-03-27 10:03:16 -04:00
|
|
|
systemProperties['POI.testdata.path'] = '../test-data'
|
2020-02-13 18:26:54 -05:00
|
|
|
|
2022-01-01 11:31:14 -05:00
|
|
|
// define the locale to not have failing tests when the locale is set differently on the current machine
|
|
|
|
systemProperties['user.language'] = 'en'
|
|
|
|
systemProperties['user.country'] = 'US'
|
|
|
|
|
2018-08-26 07:41:31 -04:00
|
|
|
// this is necessary for JDK 9+ to keep formatting dates the same way as in previous JDK-versions
|
|
|
|
systemProperties['java.locale.providers'] = 'JRE,CLDR'
|
2021-02-26 16:15:12 -05:00
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
doFirst {
|
2022-02-21 17:57:03 -05:00
|
|
|
if (jdkVersion > 8) {
|
2021-12-06 10:00:06 -05:00
|
|
|
// some options were removed in JDK 18
|
2022-02-21 17:57:03 -05:00
|
|
|
if (jdkVersion < 18) {
|
2021-12-06 10:00:06 -05:00
|
|
|
jvmArgs += [
|
|
|
|
'--illegal-access=warn',
|
|
|
|
]
|
|
|
|
}
|
2021-05-21 17:22:40 -04:00
|
|
|
|
2021-12-06 10:00:06 -05:00
|
|
|
jvmArgs += [
|
2021-05-21 17:22:40 -04:00
|
|
|
// see https://github.com/java9-modularity/gradle-modules-plugin/issues/97
|
|
|
|
// opposed to the recommendation there, it doesn't work to add ... to the dependencies
|
2024-09-15 17:19:00 -04:00
|
|
|
// testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.0'
|
2021-05-21 17:22:40 -04:00
|
|
|
// gradles gradle-worker.jar is still not a JPMS module and thus runs as unnamed module
|
2021-07-07 02:26:31 -04:00
|
|
|
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=org.apache.poi.poi',
|
2021-05-21 17:22:40 -04:00
|
|
|
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.util=ALL-UNNAMED',
|
|
|
|
'--add-exports','org.junit.platform.commons/org.junit.platform.commons.logging=ALL-UNNAMED',
|
2021-12-06 10:00:06 -05:00
|
|
|
|
|
|
|
'-Dsun.reflect.debugModuleAccessChecks=true',
|
|
|
|
'-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true',
|
2021-05-21 17:22:40 -04:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
2021-12-06 10:00:06 -05:00
|
|
|
|
|
|
|
jacoco {
|
|
|
|
excludes = [
|
|
|
|
// this is necessary to make JaCoCo work with JDK 18 for now
|
|
|
|
'sun/**',
|
|
|
|
'javax/**',
|
|
|
|
]
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
jacoco {
|
2023-12-30 06:11:24 -05:00
|
|
|
toolVersion = '0.8.11'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
2020-02-13 18:26:54 -05:00
|
|
|
|
2020-10-25 12:07:44 -04:00
|
|
|
jacocoTestReport {
|
|
|
|
reports {
|
2021-08-28 19:48:48 -04:00
|
|
|
xml.required = true
|
2020-10-25 12:07:44 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-10-14 16:46:30 -04:00
|
|
|
// ensure the build-dir exists
|
|
|
|
projectDir.mkdirs()
|
2017-03-13 09:20:51 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
if (project.hasProperty('enableSonar')) {
|
2020-11-01 04:21:29 -05:00
|
|
|
// See https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-gradle/ and
|
|
|
|
// https://docs.sonarqube.org/display/SONARQUBE52/Analyzing+with+SonarQube+Scanner+for+Gradle
|
|
|
|
// for documentation of properties.
|
|
|
|
//
|
2023-06-27 07:48:38 -04:00
|
|
|
// Some additional properties are currently set in the Jenkins-DSL, see jenkins/create_jobs.groovy
|
2020-11-01 04:21:29 -05:00
|
|
|
//
|
2024-02-20 16:09:44 -05:00
|
|
|
sonar {
|
2018-06-07 01:58:10 -04:00
|
|
|
properties {
|
|
|
|
// as we currently use build/<module>/ as project-basedir, we need to tell Sonar to use
|
|
|
|
// the root-folder as "basedir" for the projects
|
2021-03-27 10:03:16 -04:00
|
|
|
property "sonar.projectBaseDir", "$projectDir"
|
2020-11-01 04:21:29 -05:00
|
|
|
// currently supported providers on Jenkins: "hg,git": property "sonar.scm.provider", "svn"
|
2020-10-25 13:40:48 -04:00
|
|
|
|
|
|
|
// the plugin seems to not detect our non-standard build-layout
|
|
|
|
property "sonar.junit.reportPaths", "$projectDir/build/test-results/test"
|
2021-04-26 11:12:12 -04:00
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
// the Gradle run will report an invalid directory for 'ooxml-schema', but it seems to still work fine
|
|
|
|
property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/test/jacocoTestReport.xml"
|
2021-04-26 11:12:35 -04:00
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
// somehow the version was not use properly
|
|
|
|
property "sonar.projectVersion", version
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-28 15:54:57 -04:00
|
|
|
|
2021-05-21 18:32:09 -04:00
|
|
|
forbiddenApis {
|
|
|
|
bundledSignatures = [ 'jdk-unsafe', 'jdk-deprecated', 'jdk-internal', 'jdk-non-portable', 'jdk-reflection' ]
|
|
|
|
signaturesFiles = files('../src/resources/devtools/forbidden-signatures.txt')
|
|
|
|
ignoreFailures = false
|
|
|
|
suppressAnnotations = [ 'org.apache.poi.util.SuppressForbidden' ]
|
2022-06-16 18:56:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
forbiddenApisTest {
|
|
|
|
// forbiddenapis bundled signatures max supported version is 17
|
|
|
|
// also see https://github.com/policeman-tools/forbidden-apis/issues/191
|
|
|
|
targetCompatibility = (JavaVersion.VERSION_17.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_17)
|
2021-05-21 18:32:09 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
forbiddenApisMain {
|
2021-12-08 12:21:25 -05:00
|
|
|
signaturesFiles += files('../src/resources/devtools/forbidden-signatures-prod.txt')
|
2022-06-16 18:56:05 -04:00
|
|
|
targetCompatibility = (JavaVersion.VERSION_17.isCompatibleWith(JavaVersion.current()) ? JavaVersion.current() : JavaVersion.VERSION_17)
|
2021-05-21 18:32:09 -04:00
|
|
|
}
|
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
POI(MavenPublication) {
|
|
|
|
groupId 'org.apache.poi'
|
2021-05-21 17:22:40 -04:00
|
|
|
artifactId project.archivesBaseName
|
|
|
|
|
|
|
|
from components.java
|
2021-04-07 17:40:33 -04:00
|
|
|
|
|
|
|
pom {
|
|
|
|
packaging = 'jar'
|
|
|
|
url = 'https://poi.apache.org/'
|
2021-05-21 17:22:40 -04:00
|
|
|
name = 'Apache POI'
|
|
|
|
description = 'Apache POI - Java API To Access Microsoft Format Files'
|
2021-04-07 17:40:33 -04:00
|
|
|
|
|
|
|
mailingLists {
|
|
|
|
mailingList {
|
|
|
|
name = 'POI Users List'
|
|
|
|
subscribe = 'user-subscribe@poi.apache.org'
|
|
|
|
unsubscribe = 'user-unsubscribe@poi.apache.org'
|
2022-07-21 16:16:38 -04:00
|
|
|
archive = 'https://lists.apache.org/list.html?user@poi.apache.org'
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
mailingList {
|
|
|
|
name = 'POI Developer List'
|
|
|
|
subscribe = 'dev-subscribe@poi.apache.org'
|
|
|
|
unsubscribe = 'dev-unsubscribe@poi.apache.org'
|
2022-07-21 16:16:38 -04:00
|
|
|
archive = 'https://lists.apache.org/list.html?dev@poi.apache.org'
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = 'Apache License, Version 2.0'
|
|
|
|
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
|
|
|
distribution = 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
organization {
|
|
|
|
name = 'Apache Software Foundation'
|
|
|
|
url = 'http://www.apache.org/'
|
|
|
|
}
|
|
|
|
|
2022-07-21 16:16:38 -04:00
|
|
|
issueManagement {
|
|
|
|
system = 'bugzilla'
|
|
|
|
url = 'https://bz.apache.org/bugzilla'
|
|
|
|
}
|
|
|
|
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
name = 'POI Team'
|
|
|
|
id = 'poi'
|
|
|
|
email = 'user@poi.apache.org'
|
|
|
|
organization = 'Apache POI'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
withXml {
|
|
|
|
def r = asElement()
|
|
|
|
def doc = r.getOwnerDocument()
|
2021-05-21 17:22:40 -04:00
|
|
|
def hdr = new File('../legal/HEADER')
|
|
|
|
if (!hdr.exists()) hdr = new File('legal/HEADER')
|
|
|
|
def asl = doc.createComment(hdr.text)
|
2021-04-07 17:40:33 -04:00
|
|
|
// adding ASF header before root node is ignored
|
|
|
|
// doc.insertBefore(asl, doc.getDocumentElement())
|
|
|
|
r.insertBefore(asl, r.getFirstChild())
|
2021-09-12 16:31:43 -04:00
|
|
|
|
|
|
|
// Replace ooxml-full with ooxml-lite
|
|
|
|
XPath xpath = XPathFactory.newInstance().newXPath()
|
|
|
|
NodeList res = (NodeList)xpath.evaluate("//dependency/artifactId[text() = 'poi-ooxml-full']", doc, XPathConstants.NODESET)
|
|
|
|
for (int i=res.getLength()-1; i>=0; i--) {
|
|
|
|
res.item(i).setTextContent('poi-ooxml-lite')
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove duplicate entries
|
|
|
|
res = (NodeList)xpath.evaluate("//dependency[artifactId = ./preceding-sibling::dependency/artifactId]", doc, XPathConstants.NODESET)
|
|
|
|
for (int i=res.getLength()-1; i>=0; i--) {
|
|
|
|
Node n = res.item(i)
|
|
|
|
n.getParentNode().removeChild(n)
|
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-28 15:54:57 -04:00
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
generatePomFileForPOIPublication.destination = "../build/dist/maven/${project.archivesBaseName}/${project.archivesBaseName}-${project.version}.pom"
|
|
|
|
|
2021-09-12 16:31:43 -04:00
|
|
|
tasks.withType(GenerateModuleMetadata) {
|
|
|
|
enabled = false
|
|
|
|
}
|
|
|
|
|
2021-05-21 17:22:40 -04:00
|
|
|
signing {
|
2021-12-06 10:00:06 -05:00
|
|
|
setRequired {
|
|
|
|
// signing is only required if this is a release version
|
|
|
|
// and the artifacts are to be published
|
|
|
|
gradle.taskGraph.allTasks.any { it instanceof PublishToMavenRepository }
|
|
|
|
}
|
2021-05-21 17:22:40 -04:00
|
|
|
sign publishing.publications.POI
|
|
|
|
}
|
2021-09-12 16:31:43 -04:00
|
|
|
signPOIPublication.dependsOn('generatePomFileForPOIPublication')
|
2021-08-25 19:07:06 -04:00
|
|
|
|
|
|
|
spotbugs {
|
|
|
|
ignoreFailures = true
|
2021-08-28 19:48:48 -04:00
|
|
|
showStackTraces = false
|
2023-03-25 21:08:13 -04:00
|
|
|
maxHeapSize = '2g'
|
2021-08-25 19:07:06 -04:00
|
|
|
}
|
2021-09-03 17:13:36 -04:00
|
|
|
|
|
|
|
build {
|
2021-09-12 16:31:43 -04:00
|
|
|
if (project.hasProperty('signing.keyId')) {
|
|
|
|
dependsOn 'signPOIPublication'
|
|
|
|
}
|
2021-09-03 17:13:36 -04:00
|
|
|
}
|
2021-04-06 02:11:10 -04:00
|
|
|
}
|
|
|
|
|
2021-04-06 02:11:13 -04:00
|
|
|
// initial try to provide a combined JavaDoc, grouping is still missing here, though!
|
|
|
|
task allJavaDoc(type: Javadoc) {
|
2021-07-19 17:59:38 -04:00
|
|
|
var prj = [ project(':poi'), project(':poi-excelant'), project(':poi-ooxml'), project(':poi-scratchpad') ]
|
2021-09-23 15:03:06 -04:00
|
|
|
source prj.collect { it.sourceSets.main.allJava }
|
2021-04-06 02:11:13 -04:00
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
// for possible settings see https://docs.gradle.org/current/dsl/org.gradle.api.tasks.javadoc.Javadoc.html
|
|
|
|
classpath = files(subprojects.collect { it.sourceSets.main.compileClasspath })
|
|
|
|
destinationDir = file("${buildDir}/docs/javadoc")
|
|
|
|
maxMemory="2048M"
|
2021-04-06 02:11:13 -04:00
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
// for possible options see https://docs.gradle.org/current/javadoc/org/gradle/external/javadoc/StandardJavadocDocletOptions.html
|
|
|
|
options.use = true
|
|
|
|
options.splitIndex = true
|
2021-05-21 17:22:40 -04:00
|
|
|
options.addBooleanOption('Xdoclint:all,-missing', true)
|
2021-04-06 02:11:13 -04:00
|
|
|
|
2021-09-23 15:03:06 -04:00
|
|
|
title = 'POI API Documentation'
|
|
|
|
options.bottom = '<![CDATA[<i>Copyright ' + new Date().format('yyyy') + ' The Apache Software Foundation or its licensors, as applicable.</i>]]>'
|
|
|
|
|
|
|
|
options.group('DDF - Dreadful Drawing Format', 'org.apache.poi.ddf*')
|
|
|
|
options.group('HPSF - Horrible Property Set Format', 'org.apache.poi.hpsf*')
|
|
|
|
options.group('SS - Common Spreadsheet Format', 'org.apache.poi.ss*')
|
|
|
|
options.group('HSSF - Horrible Spreadsheet Format', 'org.apache.poi.hssf*')
|
|
|
|
options.group('XSSF - Open Office XML Spreadsheet Format', 'org.apache.poi.xssf*')
|
|
|
|
options.group('SL - Common Slideshow Format', 'org.apache.poi.sl*')
|
|
|
|
options.group('HSLF - Horrible Slideshow Format', 'org.apache.poi.hslf*', 'org.apache.poi.hwmf*', 'org.apache.poi.hemf*')
|
|
|
|
options.group('XSLF - Open Office XML Slideshow Format', 'org.apache.poi.xslf*')
|
|
|
|
options.group('HWPF - Horrible Word Processor Format', 'org.apache.poi.hwpf*')
|
|
|
|
options.group('XWPF - Open Office XML Word Processor Format', 'org.apache.poi.xwpf*')
|
|
|
|
options.group('HDGF - Horrible Diagram Format', 'org.apache.poi.hdgf*')
|
|
|
|
options.group('XDGF - Open Office XML Diagram Format', 'org.apache.poi.xdgf*')
|
|
|
|
options.group('HMEF - Transport Neutral Encoding Files (TNEF)', 'org.apache.poi.hmef*')
|
|
|
|
options.group('HSMF Outlook message file format', 'org.apache.poi.hsmf*')
|
|
|
|
options.group('HPBF - Publisher Format Files', 'org.apache.poi.hpbf*')
|
|
|
|
options.group('POIFS - POI File System', 'org.apache.poi.poifs*')
|
|
|
|
options.group('Utilities', 'org.apache.poi.util*')
|
|
|
|
options.group('Excelant', 'org.apache.poi.ss.excelant**')
|
|
|
|
// options.group('Examples', 'org.apache.poi.examples*')
|
2021-04-06 02:11:13 -04:00
|
|
|
}
|
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
clean {
|
|
|
|
delete "${rootDir}/build/dist"
|
|
|
|
}
|
|
|
|
|
2021-03-28 15:54:57 -04:00
|
|
|
rat {
|
|
|
|
// Input directory, defaults to '.'
|
|
|
|
inputDir.set(file("."))
|
|
|
|
|
|
|
|
// include all directories which contain files that are included in releases
|
2021-09-23 15:03:06 -04:00
|
|
|
includes = [
|
2021-07-07 06:04:18 -04:00
|
|
|
"poi-examples/**",
|
|
|
|
"poi-excelant/**",
|
|
|
|
"poi-integration/**",
|
|
|
|
"legal/**",
|
|
|
|
"poi/**",
|
|
|
|
"maven/**",
|
|
|
|
"poi-ooxml/**",
|
|
|
|
"poi-ooxml-full/**",
|
|
|
|
"poi-ooxml-lite/**",
|
|
|
|
"poi-ooxml-lite-agent/**",
|
|
|
|
"osgi/**",
|
|
|
|
"poi-scratchpad/**",
|
|
|
|
"src/**",
|
|
|
|
// "sonar/**",
|
|
|
|
"build.*"
|
2021-09-23 15:03:06 -04:00
|
|
|
]
|
2021-03-28 15:54:57 -04:00
|
|
|
|
|
|
|
// List of Gradle exclude directives, defaults to ['**/.gradle/**']
|
|
|
|
//excludes.add("main/java/org/apache/poi/**/*-chart-data.txt")
|
2021-07-07 06:04:18 -04:00
|
|
|
excludes = [
|
2021-09-23 15:03:06 -04:00
|
|
|
"build.javacheck.xml",
|
2021-07-07 06:04:18 -04:00
|
|
|
"**/build/**",
|
|
|
|
"**/out/**",
|
|
|
|
"**/*.iml",
|
|
|
|
"**/*.log",
|
|
|
|
"**/gradle-wrapper.properties",
|
|
|
|
"**/main/java/org/apache/poi/**/*-chart-data.txt",
|
|
|
|
"poi/src/main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml",
|
|
|
|
"poi-ooxml/src/main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml",
|
|
|
|
"poi-ooxml/src/main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml",
|
2022-06-28 07:11:50 -04:00
|
|
|
"poi-ooxml-full/src/main/xmlschema/org/apache/poi/schemas/*.xsd",
|
2021-07-07 06:04:18 -04:00
|
|
|
"poi-ooxml-full/src/main/xmlschema/org/apache/poi/xdgf/visio.xsd",
|
2021-09-23 15:03:06 -04:00
|
|
|
"osgi/README.md",
|
2022-03-24 00:42:27 -04:00
|
|
|
"src/resources/ooxml-lite-report.*",
|
2021-08-23 16:48:30 -04:00
|
|
|
// ignore svn conflict artifacts
|
2021-09-14 20:23:39 -04:00
|
|
|
"**/module-info.*"
|
2021-09-23 15:03:06 -04:00
|
|
|
]
|
2021-07-07 06:04:18 -04:00
|
|
|
|
2021-03-28 15:54:57 -04:00
|
|
|
/*
|
|
|
|
<exclude name="documentation/*.txt" />
|
|
|
|
<exclude name="documentation/content/xdocs/dtd/" />
|
|
|
|
<exclude name="documentation/content/xdocs/entity/" />
|
|
|
|
<exclude name="documentation/resources/images/pb-poi.cdr"/>
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Prints the list of files with unapproved licences to the console, defaults to false
|
|
|
|
verbose.set(true)
|
|
|
|
}
|
2021-04-07 17:40:33 -04:00
|
|
|
|
2023-08-09 03:22:30 -04:00
|
|
|
task jenkins(dependsOn: [
|
|
|
|
'replaceVersion',
|
|
|
|
subprojects.build,
|
|
|
|
subprojects.check,
|
|
|
|
subprojects.javadoc,
|
|
|
|
subprojects.jacocoTestReport,
|
|
|
|
subprojects.getDeps,
|
|
|
|
'srcDistZip',
|
|
|
|
'srcDistTar',
|
|
|
|
rat
|
|
|
|
]) {}
|
|
|
|
|
|
|
|
task jenkinsLite(dependsOn: [
|
|
|
|
'replaceVersion',
|
|
|
|
subprojects.build,
|
|
|
|
subprojects.test
|
|
|
|
]) {}
|
|
|
|
|
2021-04-07 17:40:33 -04:00
|
|
|
/*task downloadJarsToLibs() {
|
|
|
|
def f = new File("$projectDir/../lib/ooxml/xmlbeans-5.0.0.jar")
|
|
|
|
if (!f.exists()) {
|
|
|
|
println 'writing file ' + f.getAbsolutePath()
|
|
|
|
f.getParentFile().mkdirs()
|
|
|
|
new URL('https://ci-builds.apache.org/job/POI/job/POI-XMLBeans-DSL-1.8/lastSuccessfulBuild/artifact/build/xmlbeans-5.0.0.jar').withInputStream{ i -> f.withOutputStream{ it << i }}
|
|
|
|
}
|
|
|
|
}*/
|
|
|
|
|
2021-04-10 07:44:30 -04:00
|
|
|
//compileJava.dependsOn 'downloadJarsToLibs'
|
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
task replaceVersion() {
|
|
|
|
outputs.upToDateWhen { false }
|
2021-04-10 07:44:30 -04:00
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
var version = subprojects[0].version
|
|
|
|
var tokens = [
|
2022-01-22 01:58:54 -05:00
|
|
|
[ 'osgi', 'pom.xml', '(packaging>\\n\\s*<version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ],
|
|
|
|
[ 'osgi', 'pom.xml', '(<poi.version>)[0-9.]+(?:-SNAPSHOT|-RC\\d+)?', "\\1${version}" ]
|
2021-07-19 17:59:38 -04:00
|
|
|
// [ '.', 'build.gradle', ' version = \'[0-9.]+(?:-SNAPSHOT)?\'', " version = '${version}'" ]
|
|
|
|
]
|
2021-04-10 07:44:30 -04:00
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
doLast {
|
|
|
|
tokens.forEach {
|
|
|
|
var dir = it[0], name = it[1], match = it[2], replace = it[3]
|
|
|
|
ant.replaceregexp(match: match, replace: replace) {
|
|
|
|
fileset(dir: dir) {
|
|
|
|
include(name: name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-04-10 07:44:30 -04:00
|
|
|
}
|
2021-07-19 17:59:38 -04:00
|
|
|
}
|
2021-04-10 07:44:30 -04:00
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
task zipJavadocs(type: Zip, dependsOn: allJavaDoc) {
|
|
|
|
from('build/docs/javadoc/')
|
2021-08-28 19:48:48 -04:00
|
|
|
destinationDirectory = file('build/dist')
|
2021-07-19 17:59:38 -04:00
|
|
|
archiveBaseName = 'poi'
|
|
|
|
archiveVersion = subprojects[0].version
|
|
|
|
archiveAppendix = 'javadoc'
|
|
|
|
archiveExtension = 'jar'
|
|
|
|
}
|
2021-04-10 07:44:30 -04:00
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
tasks.withType(Tar) {
|
|
|
|
compression = Compression.GZIP
|
|
|
|
archiveExtension = 'tgz'
|
|
|
|
}
|
2021-04-10 07:44:30 -04:00
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
distributions {
|
|
|
|
src {
|
|
|
|
contents {
|
|
|
|
from('.') {
|
|
|
|
exclude '*/build/**'
|
|
|
|
exclude 'build/**'
|
|
|
|
exclude 'dist*/**'
|
|
|
|
exclude 'lib/**'
|
|
|
|
exclude 'lib.stored/**'
|
|
|
|
exclude 'bin/**'
|
|
|
|
exclude 'out/**'
|
|
|
|
exclude 'tmp/**'
|
|
|
|
exclude 'gradle/**'
|
|
|
|
exclude 'sonar/**/target/**'
|
|
|
|
exclude 'sonar/*/src/**'
|
|
|
|
exclude 'compile-lib/**'
|
|
|
|
exclude 'ooxml-lib/**'
|
|
|
|
exclude 'ooxml-testlib/**'
|
|
|
|
exclude 'scripts/**'
|
|
|
|
exclude '.gradle/**'
|
|
|
|
exclude '.idea/**'
|
|
|
|
exclude '.classpath'
|
|
|
|
exclude '.settings/**'
|
|
|
|
exclude '.project'
|
|
|
|
exclude 'TEST*'
|
|
|
|
exclude 'gradlew'
|
|
|
|
exclude 'gradlew.bat'
|
|
|
|
exclude '**/*.iml'
|
|
|
|
exclude '*.ipr'
|
|
|
|
exclude '*.iws'
|
|
|
|
exclude '*.rdf'
|
|
|
|
exclude '*.png'
|
|
|
|
exclude '*.gif'
|
|
|
|
exclude '*.jpg'
|
|
|
|
exclude '*.jpeg'
|
|
|
|
exclude '*.swp'
|
|
|
|
exclude '*.lnk'
|
|
|
|
exclude '*.log'
|
|
|
|
exclude '*.launch'
|
|
|
|
exclude '*.docx'
|
|
|
|
exclude '*.pptx'
|
|
|
|
exclude '*.xlsx'
|
2022-03-24 00:42:37 -04:00
|
|
|
|
|
|
|
// exclude intermediate files
|
|
|
|
exclude '**/*-saved.xls'
|
2021-07-19 17:59:38 -04:00
|
|
|
}
|
|
|
|
from('legal') { exclude 'HEADER' }
|
2022-12-21 20:03:34 -05:00
|
|
|
|
|
|
|
includeEmptyDirs = false
|
|
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
2021-07-19 17:59:38 -04:00
|
|
|
}
|
2021-04-10 07:44:30 -04:00
|
|
|
}
|
|
|
|
}
|
2021-07-19 17:59:38 -04:00
|
|
|
|
2022-01-10 17:06:26 -05:00
|
|
|
task soLinkCheck() {
|
|
|
|
doLast {
|
|
|
|
def path = ant.path {
|
|
|
|
fileset(dir: '.', includes: '**/*.java') {
|
|
|
|
exclude(name: 'build.gradle')
|
|
|
|
contains(text: 'stackoverflow.com')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
path.list().each {
|
|
|
|
println it
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path.size() > 0) {
|
|
|
|
// #65796 - minimize notifications about non-asf open source
|
|
|
|
throw new GradleException('License issue found - conceal the link and contradict any findings m(')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-19 17:59:38 -04:00
|
|
|
var srcDep = [
|
2022-12-27 13:45:15 -05:00
|
|
|
':poi:compileJava9',
|
|
|
|
':poi:compileTest9',
|
|
|
|
':poi-ooxml-full:compileJava9',
|
|
|
|
':poi-ooxml-lite-agent:compileJava9',
|
|
|
|
':poi-ooxml:compileJava9',
|
|
|
|
':poi-ooxml:compileTest9',
|
|
|
|
':poi-scratchpad:compileJava9',
|
|
|
|
':poi-scratchpad:compileTest9',
|
|
|
|
':poi-excelant:compileJava9',
|
|
|
|
':poi-excelant:compileTest9',
|
|
|
|
':poi-examples:compileJava9',
|
|
|
|
':poi-integration:compileTest9',
|
|
|
|
':poi-ooxml-lite:compileJava9',
|
2021-07-19 17:59:38 -04:00
|
|
|
':poi-ooxml-lite:generateModuleInfo'
|
|
|
|
]
|
|
|
|
|
2024-06-05 12:10:04 -04:00
|
|
|
srcDistTar.setArchiveFileName("apache-poi-src-${subprojects[0].version}-${dateSuffix}.tgz")
|
|
|
|
srcDistZip.setArchiveFileName("apache-poi-src-${subprojects[0].version}-${dateSuffix}.zip")
|
2021-07-19 17:59:38 -04:00
|
|
|
srcDistTar.dependsOn srcDep
|
|
|
|
srcDistZip.dependsOn srcDep
|
2022-01-10 17:06:26 -05:00
|
|
|
soLinkCheck.dependsOn srcDep
|
|
|
|
rat.dependsOn soLinkCheck
|
2021-08-09 18:32:33 -04:00
|
|
|
|
|
|
|
task fixDistDir {
|
|
|
|
doLast {
|
|
|
|
ant.mkdir(dir: 'build/dist')
|
|
|
|
ant.move(todir: 'build/dist') {
|
|
|
|
fileset(dir: 'build/distributions', includes: '*')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
srcDistZip.finalizedBy fixDistDir
|
|
|
|
srcDistTar.finalizedBy fixDistDir
|