Skip to content

Instantly share code, notes, and snippets.

@Aidan128
Last active March 6, 2022 18:09
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 Aidan128/2254e918e85b2a643c5e75387f446d83 to your computer and use it in GitHub Desktop.
Save Aidan128/2254e918e85b2a643c5e75387f446d83 to your computer and use it in GitHub Desktop.
jacoco gradle script for inclusion in module-level build.gradle
apply plugin: 'jacoco'
jacoco {
toolVersion '0.8.7'
}
task jacocoReport(type: JacocoReport) {
reports {
xml.enabled = true
html.enabled = true
}
getSourceDirectories().setFrom("${project.projectDir}/src/main/java")
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
getClassDirectories().setFrom(
fileTree(dir: "${buildDir}/intermediates/javac/debug", excludes: fileFilter),
fileTree(dir: "${buildDir}/tmp/kotlin-classes/debug", excludes: fileFilter))
getExecutionData().setFrom(
fileTree(dir: "${buildDir}/outputs/code_coverage", includes: ['*.ec']),
fileTree(dir: "${buildDir}/jacoco", includes: ['*.exec']))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment