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.
|
|
|
|
==================================================================== */
|
2016-10-14 16:46:30 -04:00
|
|
|
buildscript {
|
2018-06-07 01:58:10 -04:00
|
|
|
repositories {
|
|
|
|
maven { url "https://plugins.gradle.org/m2/" }
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.2' // 2.x requires Gradle >=4
|
|
|
|
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5"
|
|
|
|
}
|
2016-10-14 16:46:30 -04:00
|
|
|
}
|
2016-09-22 05:21:56 -04:00
|
|
|
|
2018-06-30 16:40:53 -04:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
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'
|
|
|
|
apply plugin: "org.sonarqube"
|
2017-03-10 15:13:46 -05:00
|
|
|
}
|
2016-12-26 15:47:29 -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 {
|
|
|
|
antLibs
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
antLibs("junit:junit:4.12")
|
|
|
|
antLibs("org.apache.ant:ant-junit:1.10.4")
|
|
|
|
antLibs("org.apache.ant:ant-junit4:1.10.4")
|
|
|
|
}
|
|
|
|
|
|
|
|
ant.taskdef(name: "junit",
|
|
|
|
classname: "org.apache.tools.ant.taskdefs.optional.junit.JUnitTask",
|
|
|
|
classpath: configurations.antLibs.asPath)
|
|
|
|
|
2016-09-22 05:21:56 -04:00
|
|
|
ant.importBuild 'build.xml'
|
2016-10-07 15:33:11 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Define properties for all projects, including this one
|
|
|
|
|
|
|
|
*/
|
|
|
|
allprojects {
|
2018-06-07 01:58:10 -04:00
|
|
|
apply plugin: 'eclipse'
|
|
|
|
|
|
|
|
task wrapper(type: Wrapper) {
|
2018-06-10 14:54:06 -04:00
|
|
|
gradleVersion = '4.6'
|
2018-06-07 01:58:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
task adjustWrapperPropertiesFile {
|
|
|
|
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')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
wrapper.finalizedBy adjustWrapperPropertiesFile
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
Define things that are only necessary in sub-projects, but not in the master-project itself
|
|
|
|
|
|
|
|
*/
|
|
|
|
subprojects {
|
|
|
|
//Put instructions for each sub project, but not the master
|
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'jacoco'
|
2016-10-14 16:46:30 -04:00
|
|
|
|
|
|
|
// See https://github.com/melix/japicmp-gradle-plugin
|
2018-06-07 01:58:10 -04:00
|
|
|
apply plugin: 'me.champeau.gradle.japicmp'
|
2016-10-14 16:46:30 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
version = '4.0.0-SNAPSHOT'
|
|
|
|
ext {
|
|
|
|
japicmpversion = '3.17'
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
tasks.withType(JavaCompile) {
|
|
|
|
options.encoding = 'UTF-8'
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2017-09-15 14:39:18 -04:00
|
|
|
sourceCompatibility = 1.8
|
2016-10-07 15:33:11 -04:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version
|
|
|
|
}
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
|
|
|
test {
|
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'
|
2016-10-07 15:33:11 -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"
|
|
|
|
maxHeapSize = "768m"
|
2018-02-08 14:34:22 -05:00
|
|
|
|
|
|
|
// Specifying the local via system properties did not work, so we set them this way
|
|
|
|
jvmArgs '-Duser.language=en -Duser.country=US'
|
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
|
|
|
|
|
|
|
|
systemProperties['POI.testdata.path'] = '../../test-data'
|
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'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
jacoco {
|
2018-08-23 16:23:25 -04:00
|
|
|
toolVersion = '0.8.2'
|
2016-10-07 15:33:11 -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')) {
|
|
|
|
sonarqube {
|
|
|
|
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
|
|
|
|
property "sonar.projectBaseDir", "$projectDir/../.."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-07-05 15:55:12 -04:00
|
|
|
|
|
|
|
// japicmp will fail with "Could not load" because we moved some classes out of the root-package
|
|
|
|
// for Java 9 compatibility in 4.0.0
|
|
|
|
task(japicmp, type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
|
|
|
|
to = jar.archivePath
|
|
|
|
onlyModified = true
|
|
|
|
onlyBinaryIncompatibleModified = true
|
|
|
|
failOnModification = false
|
|
|
|
txtOutputFile = file("$buildDir/reports/japi.txt")
|
|
|
|
htmlOutputFile = file("$buildDir/reports/japi.html")
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
project('main') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.main.java.srcDirs = ['../../src/java']
|
|
|
|
sourceSets.main.resources.srcDirs = ['../../src/resources/main']
|
|
|
|
sourceSets.test.java.srcDirs = ['../../src/testcases']
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile 'commons-codec:commons-codec:1.11'
|
|
|
|
compile 'commons-logging:commons-logging:1.2'
|
2018-07-14 11:49:49 -04:00
|
|
|
compile 'org.apache.commons:commons-collections4:4.2'
|
2018-06-07 01:58:10 -04:00
|
|
|
compile 'org.apache.commons:commons-math3:3.6.1'
|
2018-08-23 16:23:20 -04:00
|
|
|
compile 'javax.xml.bind:jaxb-api:2.3.0'
|
|
|
|
compile 'com.sun.xml.bind:jaxb-impl:2.3.0.1'
|
|
|
|
compile 'com.sun.xml.bind:jaxb-core:2.3.0.1'
|
|
|
|
compile 'javax.activation:activation:1.1.1'
|
2018-06-07 01:58:10 -04:00
|
|
|
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:53:36 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': 'org.apache.poi.main'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
// Create a separate jar for test-code to depend on it in other projects
|
|
|
|
// See http://stackoverflow.com/questions/5144325/gradle-test-dependency
|
|
|
|
task testJar(type: Jar, dependsOn: testClasses) {
|
|
|
|
baseName = "test-${project.archivesBaseName}"
|
|
|
|
from sourceSets.test.output
|
|
|
|
}
|
|
|
|
|
|
|
|
configurations {
|
|
|
|
tests
|
|
|
|
}
|
|
|
|
|
|
|
|
artifacts {
|
|
|
|
tests testJar
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:55:12 -04:00
|
|
|
japicmp.baseline = 'org.apache.poi:poi:' + japicmpversion + '@jar'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
project('ooxml') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.main.java.srcDirs = ['../../src/ooxml/java']
|
|
|
|
sourceSets.main.resources.srcDirs = ['../../src/ooxml/resources', '../../src/resources/ooxml']
|
|
|
|
sourceSets.test.java.srcDirs = ['../../src/ooxml/testcases']
|
2016-10-07 15:33:11 -04:00
|
|
|
|
|
|
|
// for now import the ant-task for building the jars from build.xml
|
|
|
|
// we need to rename the tasks as e.g. task "jar" conflicts with :ooxml:jar
|
2018-06-07 01:58:10 -04:00
|
|
|
ant.importBuild('../../build.xml') { antTargetName ->
|
|
|
|
'ant-' + antTargetName
|
|
|
|
}
|
|
|
|
compileJava.dependsOn 'ant-compile-ooxml-xsds'
|
|
|
|
|
|
|
|
dependencies {
|
2018-08-19 05:08:00 -04:00
|
|
|
compile 'org.apache.xmlbeans:xmlbeans:3.0.1'
|
2018-07-14 11:49:49 -04:00
|
|
|
compile 'org.apache.commons:commons-collections4:4.2'
|
2018-06-07 01:58:10 -04:00
|
|
|
compile 'org.apache.commons:commons-math3:3.6.1'
|
2018-08-16 14:36:47 -04:00
|
|
|
compile 'org.apache.commons:commons-compress:1.18'
|
2018-06-07 01:58:10 -04:00
|
|
|
compile 'org.apache.santuario:xmlsec:2.1.0'
|
|
|
|
compile 'org.bouncycastle:bcpkix-jdk15on:1.59'
|
|
|
|
compile 'com.github.virtuald:curvesapi:1.05'
|
|
|
|
|
|
|
|
// for ooxml-lite, should we move this somewhere else?
|
|
|
|
compile 'junit:junit:4.12'
|
|
|
|
|
|
|
|
compile project(':main')
|
|
|
|
compile project(':scratchpad') // TODO: get rid of this dependency!
|
|
|
|
compile files('../../ooxml-lib/ooxml-schemas-1.4.jar')
|
|
|
|
compile files('../../ooxml-lib/ooxml-security-1.1.jar')
|
|
|
|
|
|
|
|
testCompile 'junit:junit:4.12'
|
2018-08-23 16:23:20 -04:00
|
|
|
testCompile 'org.mockito:mockito-core:2.21.0'
|
2018-06-07 01:58:10 -04:00
|
|
|
testCompile 'org.xmlunit:xmlunit-core:2.5.1'
|
|
|
|
testCompile project(path: ':main', configuration: 'tests')
|
|
|
|
testCompile 'org.openjdk.jmh:jmh-core:1.19'
|
|
|
|
testCompile 'org.openjdk.jmh:jmh-generator-annprocess:1.19'
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:53:36 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': 'org.apache.poi.ooxml'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:55:12 -04:00
|
|
|
japicmp.baseline = 'org.apache.poi:poi-ooxml:' + japicmpversion + '@jar'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
project('examples') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.main.java.srcDirs = ['../../src/examples/src']
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile project(':main')
|
|
|
|
compile project(':ooxml')
|
|
|
|
}
|
2018-07-05 15:55:12 -04:00
|
|
|
|
|
|
|
japicmp.enabled = false
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
project('excelant') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.main.java.srcDirs = ['../../src/excelant/java']
|
|
|
|
sourceSets.main.resources.srcDirs = ['../../src/excelant/resources']
|
|
|
|
sourceSets.test.java.srcDirs = ['../../src/excelant/testcases']
|
|
|
|
|
|
|
|
dependencies {
|
2018-06-30 16:36:47 -04:00
|
|
|
compile 'org.apache.ant:ant:1.10.4'
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
compile project(':main')
|
|
|
|
compile project(':ooxml')
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2018-06-07 01:58:10 -04:00
|
|
|
testCompile project(path: ':main', configuration: 'tests')
|
|
|
|
}
|
2016-10-14 16:46:30 -04:00
|
|
|
|
2018-07-05 15:53:36 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': 'org.apache.poi.excelant'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:55:12 -04:00
|
|
|
japicmp.baseline = 'org.apache.poi:poi-excelant:' + japicmpversion + '@jar'
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
project('integrationtest') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.test.java.srcDirs = ['../../src/integrationtest']
|
|
|
|
|
|
|
|
dependencies {
|
2018-06-30 16:36:47 -04:00
|
|
|
compile 'org.apache.ant:ant:1.10.4'
|
2018-06-07 01:58:10 -04:00
|
|
|
|
|
|
|
compile project(':main')
|
|
|
|
compile project(':ooxml')
|
|
|
|
compile project(':scratchpad')
|
|
|
|
compile project(':examples')
|
|
|
|
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
}
|
2016-10-07 15:33:11 -04:00
|
|
|
|
2018-07-05 15:53:36 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': 'org.apache.poi.integrationtest'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test {
|
2018-06-07 01:58:10 -04:00
|
|
|
// exclude these from the normal test-run
|
|
|
|
exclude '**/TestAllFiles.class'
|
|
|
|
exclude '**/*FileHandler.class'
|
|
|
|
exclude '**/RecordsStresser.class'
|
|
|
|
}
|
|
|
|
|
|
|
|
task integrationTest(type: Test) {
|
|
|
|
// these are just tests used during development of more test-code
|
|
|
|
exclude '**/*FileHandler.class'
|
|
|
|
exclude '**/RecordStresser.class'
|
|
|
|
}
|
2018-07-05 15:55:12 -04:00
|
|
|
|
|
|
|
japicmp.enabled = false
|
2016-10-07 15:33:11 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
project('scratchpad') {
|
2018-06-07 01:58:10 -04:00
|
|
|
sourceSets.main.java.srcDirs = ['../../src/scratchpad/src']
|
|
|
|
sourceSets.main.resources.srcDirs = ['../../src/resources/scratchpad']
|
|
|
|
sourceSets.test.java.srcDirs = ['../../src/scratchpad/testcases']
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
compile project(':main')
|
|
|
|
// cyclic-dependency here: compile project(':ooxml')
|
|
|
|
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
|
|
testCompile project(path: ':main', configuration: 'tests')
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:53:36 -04:00
|
|
|
jar {
|
|
|
|
manifest {
|
|
|
|
attributes 'Automatic-Module-Name': 'org.apache.poi.scratchpad'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-05 15:55:12 -04:00
|
|
|
japicmp.baseline = 'org.apache.poi:poi-scratchpad:' + japicmpversion + '@jar'
|
2016-10-14 16:46:30 -04:00
|
|
|
}
|