mirror of https://github.com/apache/poi.git
256 lines
8.5 KiB
Groovy
256 lines
8.5 KiB
Groovy
/* ====================================================================
|
|
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 "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0"
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id("org.nosphere.apache.rat") version "0.7.0"
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
// Only add the plugin for Sonar if enabled
|
|
if (project.hasProperty('enableSonar')) {
|
|
println 'Enabling Sonar support'
|
|
apply plugin: "org.sonarqube"
|
|
}
|
|
|
|
// For help converting an Ant build to a Gradle build, see
|
|
// https://docs.gradle.org/current/userguide/ant.html
|
|
|
|
configurations {
|
|
antLibs {
|
|
attributes {
|
|
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling, Bundling.EXTERNAL))
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
antLibs("org.junit.jupiter:junit-jupiter:5.7.0")
|
|
antLibs("org.apache.ant:ant-junitlauncher:1.10.9")
|
|
}
|
|
|
|
ant.taskdef(name: "junit",
|
|
classname: "org.apache.tools.ant.taskdefs.optional.junitlauncher.confined.JUnitLauncherTask",
|
|
classpath: configurations.antLibs.asPath)
|
|
|
|
wrapper {
|
|
gradleVersion = '6.8'
|
|
}
|
|
|
|
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 properties for all projects, including this one
|
|
*/
|
|
allprojects {
|
|
apply plugin: 'eclipse'
|
|
}
|
|
|
|
/**
|
|
|
|
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-library'
|
|
apply plugin: 'jacoco'
|
|
|
|
version = '5.0.1-SNAPSHOT'
|
|
ext {
|
|
bouncyCastleVersion = '1.68'
|
|
commonsCodecVersion = '1.15'
|
|
commonsCompressVersion = '1.20'
|
|
commonsMathVersion = '3.6.1'
|
|
junitVersion = '5.7.0'
|
|
log4jVersion = '2.14.0'
|
|
mockitoVersion = '3.6.0'
|
|
hamcrestVersion = '2.2'
|
|
xmlbeansVersion = '5.0.0'
|
|
batikVersion = '1.14'
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
sourceCompatibility = 1.8
|
|
targetCompatibility = 1.8
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url 'https://repository.apache.org/content/repositories/releases'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
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}"
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes 'Implementation-Title': 'Apache POI', 'Implementation-Version': version
|
|
}
|
|
}
|
|
|
|
test {
|
|
// make XML test-results available for Jenkins CI
|
|
useJUnitPlatform()
|
|
reports {
|
|
junitXml.enabled = true
|
|
}
|
|
|
|
// 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'
|
|
|
|
// Exclude Test Suites
|
|
exclude '**/All*Tests.class'
|
|
exclude '**/HSSFTests.class'
|
|
|
|
// set heap size for the test JVM(s)
|
|
minHeapSize = "128m"
|
|
maxHeapSize = "768m"
|
|
|
|
// Specifying the local via system properties did not work, so we set them this way
|
|
jvmArgs '-Duser.language=en -Duser.country=US'
|
|
|
|
// 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'
|
|
|
|
// this is necessary for JDK 9+ to keep formatting dates the same way as in previous JDK-versions
|
|
systemProperties['java.locale.providers'] = 'JRE,CLDR'
|
|
|
|
systemProperties['junit.jupiter.execution.parallel.enabled'] = 'false'
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = '0.8.6'
|
|
}
|
|
|
|
jacocoTestReport {
|
|
reports {
|
|
xml.enabled true
|
|
}
|
|
}
|
|
|
|
// ensure the build-dir exists
|
|
projectDir.mkdirs()
|
|
|
|
if (project.hasProperty('enableSonar')) {
|
|
// 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.
|
|
//
|
|
// Some additional properties are currently set in the Jenkins-DSL, see jenksin/create_jobs.groovy
|
|
//
|
|
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"
|
|
// currently supported providers on Jenkins: "hg,git": property "sonar.scm.provider", "svn"
|
|
|
|
// the plugin seems to not detect our non-standard build-layout
|
|
property "sonar.junit.reportPaths", "$projectDir/build/test-results/test"
|
|
property "sonar.coverage.jacoco.xmlReportPaths", "$projectDir/build/reports/jacoco/test/jacocoTestReport.xml"
|
|
}
|
|
}
|
|
}
|
|
|
|
task jenkins
|
|
jenkins.dependsOn build
|
|
jenkins.dependsOn check
|
|
jenkins.dependsOn javadoc
|
|
jenkins.dependsOn jacocoTestReport
|
|
jenkins.dependsOn rat
|
|
}
|
|
|
|
rat {
|
|
// Input directory, defaults to '.'
|
|
inputDir.set(file("."))
|
|
|
|
// include all directories which contain files that are included in releases
|
|
includes.add("examples/**")
|
|
includes.add("excelant/**")
|
|
includes.add("integrationtest/**")
|
|
includes.add("legal/**")
|
|
includes.add("main/**")
|
|
includes.add("maven/**")
|
|
includes.add("ooxml/**")
|
|
includes.add("ooxml-schema/**")
|
|
//includes.add("osgi/**")
|
|
includes.add("scratchpad/**")
|
|
includes.add("src/**")
|
|
//includes.add("sonar/**")
|
|
includes.add("build.*")
|
|
|
|
// List of Gradle exclude directives, defaults to ['**/.gradle/**']
|
|
//excludes.add("main/java/org/apache/poi/**/*-chart-data.txt")
|
|
excludes.add("**/build/**")
|
|
excludes.add("**/out/**")
|
|
excludes.add("**/*.iml")
|
|
excludes.add("**/*.log")
|
|
excludes.add("**/main/java/org/apache/poi/**/*-chart-data.txt")
|
|
excludes.add("main/src/main/resources/org/apache/poi/sl/draw/geom/presetShapeDefinitions.xml")
|
|
excludes.add("ooxml/src/main/resources/org/apache/poi/xslf/usermodel/notesMaster.xml")
|
|
excludes.add("ooxml/src/main/resources/org/apache/poi/xssf/usermodel/presetTableStyles.xml")
|
|
excludes.add("ooxml-schema/src/main/xmlschema/org/apache/poi/schemas/XAdES*.xsd")
|
|
excludes.add("ooxml-schema/src/main/xmlschema/org/apache/poi/schemas/xmldsig-core-schema.xsd")
|
|
excludes.add("ooxml-schema/src/main/xmlschema/org/apache/poi/xdgf/visio.xsd")
|
|
/*
|
|
<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)
|
|
}
|