Skip to content

Instantly share code, notes, and snippets.

@nathanmkaya
Created October 4, 2018 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanmkaya/a3cbff9b8ace48c4774fb6c654414f33 to your computer and use it in GitHub Desktop.
Save nathanmkaya/a3cbff9b8ace48c4774fb6c654414f33 to your computer and use it in GitHub Desktop.
apply plugin: 'jacoco'
jacoco {
toolVersion = "$jacocoVersion"
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def javaClasses = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
def kotlinClasses = fileTree(dir: "$project.buildDir/tmp/kotlin-classes/debug", excludes: fileFilter)
def javaSrc = "$project.projectDir/src/main/java"
def kotlinSrc = "$project.projectDir/src/main/kotlin"
sourceDirectories = files([javaSrc, kotlinSrc])
classDirectories = files([javaClasses, kotlinClasses])
executionData = fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment