Skip to content

Commit

Permalink
Add jacoco coverage report.
Browse files Browse the repository at this point in the history
  • Loading branch information
sjudd committed Nov 2, 2014
1 parent 767087d commit 34f797b
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ script: 'travis_retry ./gradlew build --parallel'

after_success:
- scripts/travis-sonatype-publish.sh
- ./gradlew jacocoTestReport coveralls
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ buildscript {
dependencies {
classpath "org.robolectric:robolectric-gradle-plugin:${ROBOLECTRIC_GRADLE_VERSION}"
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}"
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${COVERALLS_GRADLE_VERSION}"
}
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ OK_HTTP_VERSION=2.0.0
ANDROID_GRADLE_VERSION=0.13.3

ROBOLECTRIC_GRADLE_VERSION=0.12.0
COVERALLS_GRADLE_VERSION=2.0.1
JUNIT_VERSION=4.11
MOCKITO_VERSION=1.9.5
ROBOLECTRIC_VERSION=2.4-SNAPSHOT
Expand Down
39 changes: 39 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ apply plugin: 'robolectric'
apply plugin: 'maven'
apply plugin: 'findbugs'
apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'

findbugs {
toolVersion = "2.0.3"
}
jacoco {
toolVersion = "0.7.1.201405082137"
}
coveralls {
jacocoReportPath = 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
}

dependencies {
compile project(':third_party:gif_decoder')
Expand Down Expand Up @@ -36,6 +44,12 @@ android {
versionCode = VERSION_CODE
versionName = VERSION_NAME
}

buildTypes {
debug {
testCoverageEnabled = true
}
}
}

afterEvaluate {
Expand Down Expand Up @@ -86,4 +100,29 @@ afterEvaluate {
}

check.dependsOn('pmd')

task jacocoTestReport(type:JacocoReport, dependsOn: testDebug) {
def coverageSourceDirs = ['src/main/java']
group = "Reporting"

description = "Generate Jacoco coverage reports"

classDirectories = fileTree(
dir: 'build/intermediates/classes/debug',
excludes: ['**/R.class',
'**/R$*.class',
'**/*$ViewInjector*.*',
'**/BuildConfig.*',
'**/Manifest*.*']
)

additionalSourceDirs = files(coverageSourceDirs)
sourceDirectories = files(coverageSourceDirs)
executionData = files('build/jacoco/testDebug.exec')

reports {
xml.enabled = true
html.enabled = true
}
}
}

0 comments on commit 34f797b

Please sign in to comment.