datahub/gradle/scripts/coverage.gradle

53 lines
1.3 KiB
Groovy

apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'com.palantir.jacoco-full-report'
apply plugin: 'jacoco'
// Must match the version used in jacoco4sbt plugin.
ext.jacocoVersion = '0.7.1.201405082137'
jacoco {
toolVersion = jacocoVersion
}
jacocoFull {
excludeProject ":wherehows-backend", ":wherehows-hadoop", ':wherehows-data-model', ':wherehows-etl', ':wherehows-common'
}
// Add the jacoco plugin to each project
subprojects {
plugins.apply('java')
plugins.apply('jacoco')
jacoco {
toolVersion = jacocoVersion
}
jacocoTestReport {
reports {
xml.enabled true
html.enabled true
csv.enabled false
}
}
plugins.withType(PlayPlugin).whenPluginAdded {
jacocoTestReport {
executionData = files("${buildDir}/jacoco/testPlayBinary.exec")
sourceDirectories = files("app")
classDirectories = files("${buildDir}/playBinary/classes")
}
}
}
// Configure the coveralls task to read the aggregated JaCoCo report
coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoFullReport/jacocoFullReport.xml"
}
tasks.coveralls {
doFirst {
// Must set this at task execution time for the play.gradle's sourceSets modification to take effect.
coveralls.sourceDirs = subprojects.sourceSets.main.java.srcDirs.flatten()
}
}