Created
October 4, 2018 12:51
-
-
Save nathanmkaya/a3cbff9b8ace48c4774fb6c654414f33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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