Coverage:

* Exclude "examples" from coverage in Jenkins, add some comments
* Fix warning in newer Gradle versions
* Adjust coverage-excludes in build.xml

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1776715 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-12-31 09:43:13 +00:00
parent b2a4c75665
commit 1350ad3eb3
3 changed files with 15 additions and 18 deletions

View File

@ -47,13 +47,15 @@ allprojects {
gradleVersion = '2.14.1' gradleVersion = '2.14.1'
} }
task adjustWrapperPropertiesFile << { task adjustWrapperPropertiesFile {
doLast {
ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) { ant.replaceregexp(match:'^#.*', replace:'', flags:'g', byline:true) {
fileset(dir: project.projectDir, includes: 'gradle/wrapper/gradle-wrapper.properties') 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') } 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') ant.fixcrlf(file: 'gradle/wrapper/gradle-wrapper.properties', eol: 'lf')
} }
}
wrapper.finalizedBy adjustWrapperPropertiesFile wrapper.finalizedBy adjustWrapperPropertiesFile
} }

View File

@ -239,7 +239,7 @@ under the License.
<!-- Coverage --> <!-- Coverage -->
<property name="coverage.dir" value="build/coverage"/> <property name="coverage.dir" value="build/coverage"/>
<!-- Exclude some uninteresting classes from coverage-instrumentation as we do not want to measure coverage in those packages anyway --> <!-- Exclude some uninteresting classes from coverage-instrumentation as we do not want to measure coverage in those packages anyway -->
<property name="coverage.excludes" value="org.openxmlformats.*:com.*:org.junit.*:junit.*:org.etsi.*:org.w3.*"/> <property name="coverage.excludes" value="org.openxmlformats.*:com.*:org.junit.*:junit.*:org.etsi.*:org.w3.*:org.slf4j.*:org.hamcrest.*:org.bouncycastle.*:org.apache.xmlbeans.*:org.apache.tools.*:org.apache.commons.*:org.apache.jcp.*:sun.*:schemaorg_apache_xmlbeans.*"/>
<property name="file.leak.detector" value="-Dthis.is.a.dummy=true"/> <property name="file.leak.detector" value="-Dthis.is.a.dummy=true"/>
@ -1209,13 +1209,8 @@ under the License.
<classfiles> <classfiles>
<fileset dir="${ooxml.output.dir}"/> <fileset dir="${ooxml.output.dir}"/>
<!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code... <!-- there are no actual POI classes in build/ooxml-lite-classes, only generated code...
fileset dir="${ooxml.lite.output.dir}"> <fileset dir="${ooxml.lite.output.dir}"/>
<exclude name="org/openxmlformats/**"/> -->
<exclude name="schema*/**"/>
<exclude name="org/etsi/**"/>
<exclude name="org/w3/**"/>
<exclude name="com/**"/>
</fileset-->
</classfiles> </classfiles>
<sourcefiles encoding="UTF-8"> <sourcefiles encoding="UTF-8">
<fileset dir="${ooxml.src}"/> <fileset dir="${ooxml.src}"/>
@ -1323,7 +1318,7 @@ under the License.
<target name="test-hssf" unless="main.hssf.test.notRequired" <target name="test-hssf" unless="main.hssf.test.notRequired"
depends="compile-main, -test-main-hssf-check,jacocotask" xmlns:jacoco="antlib:org.jacoco.ant" depends="compile-main, -test-main-hssf-check,jacocotask" xmlns:jacoco="antlib:org.jacoco.ant"
description="test HSSF classes only"> description="test HSSF classes only">
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-main.exec"> <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-hssf.exec">
<junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}" <junit fork="yes" forkmode="once" printsummary="yes" haltonfailure="${halt.on.test.failure}"
failureproperty="main.hssf.test.failed" showoutput="true"> failureproperty="main.hssf.test.failed" showoutput="true">
<classpath refid="test.classpath"/> <classpath refid="test.classpath"/>
@ -1506,7 +1501,7 @@ under the License.
<attribute name="classpath"/> <attribute name="classpath"/>
<attribute name="type"/> <attribute name="type"/>
<sequential> <sequential>
<jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}.exec"> <jacoco:coverage enabled="${coverage.enabled}" excludes="${coverage.excludes}" destfile="build/jacoco-@{type}-ss.exec">
<junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}" <junit printsummary="yes" fork="yes" forkmode="once" haltonfailure="${halt.on.test.failure}"
failureproperty="ooxml.ss.test.failed"> failureproperty="ooxml.ss.test.failed">
<classpath refid="@{classpath}"/> <classpath refid="@{classpath}"/>

View File

@ -67,7 +67,7 @@ def poijobs = [
def svnBase = 'https://svn.apache.org/repos/asf/poi/trunk' def svnBase = 'https://svn.apache.org/repos/asf/poi/trunk'
def defaultJdk = '1.6' def defaultJdk = '1.6'
def defaultTrigger = 'H/15 * * * *' def defaultTrigger = 'H/15 * * * *' // check SCM every 60/15 = 4 minutes
def defaultEmail = 'dev@poi.apache.org' def defaultEmail = 'dev@poi.apache.org'
def defaultAnt = 'Ant (latest)' def defaultAnt = 'Ant (latest)'
def defaultSlaves = 'ubuntu&&!cloud-slave' def defaultSlaves = 'ubuntu&&!cloud-slave'
@ -82,7 +82,6 @@ def jdkMapping = [
] ]
poijobs.each { poijob -> poijobs.each { poijob ->
def jdkKey = poijob.jdk ?: defaultJdk def jdkKey = poijob.jdk ?: defaultJdk
def trigger = poijob.trigger ?: defaultTrigger def trigger = poijob.trigger ?: defaultTrigger
def email = poijob.email ?: defaultEmail def email = poijob.email ?: defaultEmail
@ -133,6 +132,7 @@ for more details about the DSL.</b>
environmentVariables { environmentVariables {
env('LANG', 'en_US.UTF-8') env('LANG', 'en_US.UTF-8')
if(jdkKey == '1.9') { if(jdkKey == '1.9') {
// when using JDK 9 for running Ant, we need to provide more packages for the forbidden-api-checks task
env('ANT_OPTS', '--add-modules=java.xml.bind') env('ANT_OPTS', '--add-modules=java.xml.bind')
} }
} }
@ -300,7 +300,7 @@ for more details about the DSL.</b>
} }
} }
jacocoCodeCoverage { jacocoCodeCoverage {
classPattern('build/classes,build/examples-classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes,build/*/build/classes') classPattern('build/classes,build/excelant-classes,build/ooxml-classes,build/scratchpad-classes,build/*/build/classes')
execPattern('build/*.exec,build/*/build/jacoco/*.exec') execPattern('build/*.exec,build/*/build/jacoco/*.exec')
sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src') sourcePattern('src/java,src/excelant/java,src/ooxml/java,src/scratchpad/src')
exclusionPattern('com/microsoft/**,org/openxmlformats/**,org/etsi/**,org/w3/**,schemaorg*/**,schemasMicrosoft*/**,org/apache/poi/hdf/model/hdftypes/definitions/*.class,org/apache/poi/hwpf/model/types/*.class,org/apache/poi/hssf/usermodel/DummyGraphics2d.class,org/apache/poi/sl/draw/binding/*.class') exclusionPattern('com/microsoft/**,org/openxmlformats/**,org/etsi/**,org/w3/**,schemaorg*/**,schemasMicrosoft*/**,org/apache/poi/hdf/model/hdftypes/definitions/*.class,org/apache/poi/hwpf/model/types/*.class,org/apache/poi/hssf/usermodel/DummyGraphics2d.class,org/apache/poi/sl/draw/binding/*.class')