Created
June 15, 2015 14:51
-
-
Save vlad-kasatkin/4acd1c02908d5e9d95ce to your computer and use it in GitHub Desktop.
jacoco task for espresso coverage
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 { | |
version "0.7.1.201405082137" | |
} | |
task jacocoTestReportAndroidTest(type: JacocoReport, dependsOn: "connectedAndroidTest") { | |
def coverageSourceDirs = [ | |
'src/main/java' | |
] | |
group = "Reporting" | |
description = "Generates Jacoco coverage reports" | |
reports { | |
csv.enabled false | |
xml{ | |
enabled = true | |
destination "${buildDir}/reports/jacoco/jacoco.xml" | |
} | |
html{ | |
enabled true | |
destination "${buildDir}/jacocoHtml" | |
} | |
} | |
classDirectories = fileTree( | |
dir: 'build/intermediates/classes', | |
excludes: ['**/R.class', | |
'**/R$*.class', | |
'**/BuildConfig.*', | |
'**/Manifest*.*', | |
'**/*Activity*.*', | |
'**/*Fragment*.*' | |
] | |
) | |
sourceDirectories = files(coverageSourceDirs) | |
additionalSourceDirs = files(coverageSourceDirs) | |
if (project.hasProperty('coverageFiles')) { | |
// convert the comma separated string to an array to create an aggregate report from | |
// multiple coverage.ec files | |
def coverageFilesArray = coverageFiles.split(',') | |
executionData = files(coverageFilesArray) | |
} | |
else { | |
executionData = files('build/outputs/code-coverage/connected/coverage.ec') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment