提交 34f797ba 编写于 作者: S Sam Judd

Add jacoco coverage report.

上级 767087d4
...@@ -9,3 +9,4 @@ script: 'travis_retry ./gradlew build --parallel' ...@@ -9,3 +9,4 @@ script: 'travis_retry ./gradlew build --parallel'
after_success: after_success:
- scripts/travis-sonatype-publish.sh - scripts/travis-sonatype-publish.sh
- ./gradlew jacocoTestReport coveralls
...@@ -10,6 +10,7 @@ buildscript { ...@@ -10,6 +10,7 @@ buildscript {
dependencies { dependencies {
classpath "org.robolectric:robolectric-gradle-plugin:${ROBOLECTRIC_GRADLE_VERSION}" classpath "org.robolectric:robolectric-gradle-plugin:${ROBOLECTRIC_GRADLE_VERSION}"
classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}" classpath "com.android.tools.build:gradle:${ANDROID_GRADLE_VERSION}"
classpath "org.kt3k.gradle.plugin:coveralls-gradle-plugin:${COVERALLS_GRADLE_VERSION}"
} }
} }
......
...@@ -21,6 +21,7 @@ OK_HTTP_VERSION=2.0.0 ...@@ -21,6 +21,7 @@ OK_HTTP_VERSION=2.0.0
ANDROID_GRADLE_VERSION=0.13.3 ANDROID_GRADLE_VERSION=0.13.3
ROBOLECTRIC_GRADLE_VERSION=0.12.0 ROBOLECTRIC_GRADLE_VERSION=0.12.0
COVERALLS_GRADLE_VERSION=2.0.1
JUNIT_VERSION=4.11 JUNIT_VERSION=4.11
MOCKITO_VERSION=1.9.5 MOCKITO_VERSION=1.9.5
ROBOLECTRIC_VERSION=2.4-SNAPSHOT ROBOLECTRIC_VERSION=2.4-SNAPSHOT
......
...@@ -3,10 +3,18 @@ apply plugin: 'robolectric' ...@@ -3,10 +3,18 @@ apply plugin: 'robolectric'
apply plugin: 'maven' apply plugin: 'maven'
apply plugin: 'findbugs' apply plugin: 'findbugs'
apply plugin: 'pmd' apply plugin: 'pmd'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
findbugs { findbugs {
toolVersion = "2.0.3" toolVersion = "2.0.3"
} }
jacoco {
toolVersion = "0.7.1.201405082137"
}
coveralls {
jacocoReportPath = 'build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml'
}
dependencies { dependencies {
compile project(':third_party:gif_decoder') compile project(':third_party:gif_decoder')
...@@ -36,6 +44,12 @@ android { ...@@ -36,6 +44,12 @@ android {
versionCode = VERSION_CODE versionCode = VERSION_CODE
versionName = VERSION_NAME versionName = VERSION_NAME
} }
buildTypes {
debug {
testCoverageEnabled = true
}
}
} }
afterEvaluate { afterEvaluate {
...@@ -86,4 +100,29 @@ afterEvaluate { ...@@ -86,4 +100,29 @@ afterEvaluate {
} }
check.dependsOn('pmd') 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
}
}
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册