Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Created April 9, 2015 10:43
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 hitherejoe/e723a5bb910a99098ea9 to your computer and use it in GitHub Desktop.
Save hitherejoe/e723a5bb910a99098ea9 to your computer and use it in GitHub Desktop.
Android Jacoco setup with Gradle
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
versionNameSuffix " Debug"
debuggable true
testCoverageEnabled = true
}
}
apply plugin: ‘jacoco’
jacoco {
toolVersion = “0.7.1.201405082137”
}
def coverageSourceDirs = [
‘../app/src/main/java’
]
task generateJacocoTestReports(type:JacocoReport, dependsOn: "testDebug") {
group = "Reporting"
reports = {
xml.enabled = true
html.enabled = true
}
description = "Generate Jacoco Robolectric unit test coverage reports”
classDirectories = fileTree(
dir: '../app/build/intermediates/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)
sourceDirectories = files(coverageSourceDirs)
additionalSourceDirs = files(coverageSourceDirs)
executionData = files('../app/build/jacoco/testDebug.exec')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment