Created
April 9, 2015 10:43
-
-
Save hitherejoe/e723a5bb910a99098ea9 to your computer and use it in GitHub Desktop.
Android Jacoco setup with Gradle
This file contains 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
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