Skip to content

Commit

Permalink
FIX: code coverage XML reports generation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkucherenko committed Mar 9, 2015
1 parent 62b4686 commit a062811
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
18 changes: 11 additions & 7 deletions library/build.gradle
Expand Up @@ -22,6 +22,13 @@ buildscript {

// CONFIGURATION based on: http://tools.android.com/tech-docs/new-build-system/user-guide

if (useJacoco) {
// NOTE: very important to register JaCoCo plugin before the Android, otherwise XML
// coverage report will be impossible to generate. Will work only HTML reporting.

/* http://raptordigital.blogspot.se/2014/08/code-coverage-reports-using-robolectric.html */
apply plugin: 'jacoco'
}
apply plugin: 'com.android.library'
apply from: "${rootProject.rootDir}/gradle/config/quality.gradle"

Expand Down Expand Up @@ -204,19 +211,16 @@ task patchMockableAndroidJar(type: Zip, dependsOn: copyMockableAndroidJar) {
/* [ COVERALLS ] ==================================================================================================== */

if (useJacoco) {
/* http://raptordigital.blogspot.se/2014/08/code-coverage-reports-using-robolectric.html */
apply plugin: 'jacoco'

/* be specific about JaCoCo version. */
jacoco {
version JaCoCoVersion
//destinationFile = file("${project.buildDir}/jacoco/jacoco.exec")
}
}

apply plugin: 'com.github.kt3k.coveralls'
coveralls.jacocoReportPath = "${project.buildDir}/outputs/reports/jacoco/jacoco.xml"
tasks.coveralls.dependsOn 'jacocoResults'
apply plugin: 'com.github.kt3k.coveralls'
coveralls.jacocoReportPath = "${project.buildDir}/reports/jacoco/jacoco.xml"
tasks.coveralls.dependsOn 'jacocoResults'
}

/* [ ARTIFACTS ] ==================================================================================================== */

Expand Down
15 changes: 8 additions & 7 deletions samples/sample-01/build.gradle
Expand Up @@ -17,6 +17,10 @@ buildscript {

// CONFIGURATION based on: http://tools.android.com/tech-docs/new-build-system/user-guide

if (useJacoco) {
/* http://raptordigital.blogspot.se/2014/08/code-coverage-reports-using-robolectric.html */
apply plugin: 'jacoco'
}
apply plugin: 'com.android.application'
apply from: "${rootProject.rootDir}/gradle/config/quality.gradle"

Expand Down Expand Up @@ -348,18 +352,15 @@ android {
/* [ COVERALLS ] ==================================================================================================== */

if (useJacoco) {
/* http://raptordigital.blogspot.se/2014/08/code-coverage-reports-using-robolectric.html */
apply plugin: 'jacoco'

/* be specific about JaCoCo version. */
jacoco {
version JaCoCoVersion
}
}

apply plugin: 'com.github.kt3k.coveralls'
coveralls.jacocoReportPath = "${project.buildDir}/outputs/reports/jacoco/jacoco.xml"
tasks.coveralls.dependsOn 'jacocoResults'
apply plugin: 'com.github.kt3k.coveralls'
coveralls.jacocoReportPath = "${project.buildDir}/reports/jacoco/jacoco.xml"
tasks.coveralls.dependsOn 'jacocoResults'
}

/* [ CUSTOM TASKS ] ================================================================================================= */

Expand Down

0 comments on commit a062811

Please sign in to comment.