Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save khauser/5a9fb7b4ae4192992c28 to your computer and use it in GitHub Desktop.
Save khauser/5a9fb7b4ae4192992c28 to your computer and use it in GitHub Desktop.
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'jacoco'
repositories {
mavenCentral()
}
// Only report code coverage for projects that are distributed
def publishedProjects = subprojects.findAll { it.path != ':simulator' }
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
//dependsOn(publishedProjects.test)
additionalSourceDirs = files(publishedProjects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(publishedProjects.sourceSets.main.allSource.srcDirs)
classDirectories = files(publishedProjects.sourceSets.main.output)
executionData = files(publishedProjects.jacocoTestReport.executionData)
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
coveralls {
sourceDirs = publishedProjects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment