poi/build.gradle

304 lines
9.3 KiB
Groovy
Raw Normal View History

/* ====================================================================
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.
==================================================================== */
buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.2'
}
}
/* We cannot add this here as the Sonar-plugin requires Java 8, but
* we want to at least keep Java 7 compatibility for building POI via Gradle for now
plugins {
id "org.sonarqube" version "2.2.1"
}*/
// For help converting an Ant build to a Gradle build, see
// https://docs.gradle.org/current/userguide/ant.html
ant.importBuild 'build.xml'
/**
Define properties for all projects, including this one
*/
allprojects {
apply plugin: 'eclipse'
task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
}
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
}
/**
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'
// See https://github.com/melix/japicmp-gradle-plugin
apply plugin: 'me.champeau.gradle.japicmp'
version = '3.16-beta3'
ext {
japicmpversion = '3.15'
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
sourceCompatibility = 1.6
repositories {
mavenCentral()
}
jar {
manifest {
attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version
}
}
test {
// 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'
systemProperties = System.properties
// set heap size for the test JVM(s)
minHeapSize = "128m"
maxHeapSize = "768m"
// 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'
//systemProperties['user.language'] = 'en'
//systemProperties['user.country'] = 'US'
}
test.beforeSuite { TestDescriptor suite ->
System.setProperty('user.language', 'en')
System.setProperty('user.country', 'US')
}
jacoco {
toolVersion = '0.7.8'
}
// ensure the build-dir exists
projectDir.mkdirs()
}
project('main') {
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.10'
compile 'commons-logging:commons-logging:1.2'
compile 'org.apache.commons:commons-collections4:4.1'
testCompile 'junit:junit:4.12'
}
// 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
}
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
baseline = 'org.apache.poi:poi:' + japicmpversion + '@jar'
to = jar.archivePath
onlyModified = true
onlyBinaryIncompatibleModified = true
failOnModification = false
txtOutputFile = file("$buildDir/reports/japi.txt")
htmlOutputFile = file("$buildDir/reports/japi.html")
}
}
project('ooxml') {
sourceSets.main.java.srcDirs = ['../../src/ooxml/java']
sourceSets.main.resources.srcDirs = ['../../src/ooxml/resources', '../../src/resources/ooxml']
sourceSets.test.java.srcDirs = ['../../src/ooxml/testcases']
// 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
ant.importBuild('../../build.xml') { antTargetName ->
'ant-' + antTargetName
}
compileJava.dependsOn 'ant-compile-ooxml-xsds'
dependencies {
compile 'org.apache.xmlbeans:xmlbeans:2.6.0'
compile 'org.apache.commons:commons-collections4:4.1'
compile 'org.apache.santuario:xmlsec:2.0.6'
compile 'org.bouncycastle:bcpkix-jdk15on:1.54'
compile 'com.github.virtuald:curvesapi:1.04'
// 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.3.jar')
compile files('../../ooxml-lib/ooxml-security-1.1.jar')
testCompile 'junit:junit:4.12'
testCompile project(path: ':main', configuration: 'tests')
}
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
baseline = 'org.apache.poi:poi-ooxml:' + japicmpversion + '@jar'
to = jar.archivePath
onlyModified = true
onlyBinaryIncompatibleModified = true
failOnModification = false
txtOutputFile = file("$buildDir/reports/japi.txt")
htmlOutputFile = file("$buildDir/reports/japi.html")
}
}
project('examples') {
sourceSets.main.java.srcDirs = ['../../src/examples/src']
dependencies {
compile project(':main')
compile project(':ooxml')
}
}
project('excelant') {
sourceSets.main.java.srcDirs = ['../../src/excelant/java']
sourceSets.main.resources.srcDirs = ['../../src/excelant/resources']
sourceSets.test.java.srcDirs = ['../../src/excelant/testcases']
dependencies {
compile 'org.apache.ant:ant:1.9.4'
compile project(':main')
compile project(':ooxml')
testCompile project(path: ':main', configuration: 'tests')
}
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
baseline = 'org.apache.poi:poi-excelant:' + japicmpversion + '@jar'
to = jar.archivePath
onlyModified = true
onlyBinaryIncompatibleModified = true
failOnModification = false
txtOutputFile = file("$buildDir/reports/japi.txt")
htmlOutputFile = file("$buildDir/reports/japi.html")
}
}
project('integrationtest') {
sourceSets.test.java.srcDirs = ['../../src/integrationtest']
dependencies {
compile 'org.apache.ant:ant:1.9.4'
compile project(':main')
compile project(':ooxml')
compile project(':scratchpad')
compile project(':examples')
testCompile 'junit:junit:4.12'
}
test {
// 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'
}
}
project('scratchpad') {
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')
}
// TOOD: we should not duplicate this task in each project, but I did not figure out how to inject the artifactId for each project
task japicmp(type: me.champeau.gradle.ArtifactJapicmpTask, dependsOn: jar) {
baseline = 'org.apache.poi:poi-scratchpad:' + japicmpversion + '@jar'
to = jar.archivePath
onlyModified = true
onlyBinaryIncompatibleModified = true
failOnModification = false
txtOutputFile = file("$buildDir/reports/japi.txt")
htmlOutputFile = file("$buildDir/reports/japi.html")
}
}