Last active
December 7, 2020 12:47
-
-
Save titoaesj/9290b1389e205e6f9405e29ff29e1ab2 to your computer and use it in GitHub Desktop.
Configuração Jacoco Android
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 = '0.8.6' //Use latest version | |
} | |
tasks.withType(Test) { | |
jacoco.includeNoLocationClasses = true | |
} | |
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { | |
reports { | |
xml.enabled = true | |
html.enabled = true | |
} | |
def fileFilter = ['**/R.class', | |
'**/R$*.class', | |
'**/BuildConfig.*', | |
'**/Manifest*.*', | |
'**/*Test*.*', | |
'**/di/**/*.*', | |
'**/contracts/*.*'] | |
def moduleASrc = "${project.projectDir}/moduleA/**/*.*" | |
def moduleBSrc = "${project.projectDir}/src/moduleB/java/**/*.*" | |
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter) | |
def kotlinDebugTree = fileTree(dir: "${buildDir}/tmp/kotlin-classes/debug", excludes: fileFilter) | |
sourceDirectories.from = files([moduleASrc], [moduleBSrc]) | |
classDirectories.from = files([debugTree], [kotlinDebugTree]) | |
executionData.from = fileTree(dir: "$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