Skip to content

Commit

Permalink
Coverage (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpreussler committed Jan 2, 2018
1 parent 17fa963 commit 8609f07
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Expand Up @@ -12,3 +12,8 @@ script:
- echo "Travis branch is $TRAVIS_BRANCH"
- echo "Travis branch is in pull request $TRAVIS_PULL+REQUEST"
- ./gradlew assembleRelease --info
- ./gradlew codeCoverageReport

after_success:
- bash <(curl -s https://codecov.io/bash)

51 changes: 49 additions & 2 deletions lib/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: 'jacoco'

def projectName="clean-simple-calendar"

Expand All @@ -19,8 +20,17 @@ android {
}
}


buildTypes {
debug {
testCoverageEnabled true
}
}

testOptions {
unitTests.returnDefaultValues = true
unitTests {
returnDefaultValues = true
}
}

libraryVariants.all { variant ->
Expand All @@ -36,7 +46,6 @@ android {


dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:support-annotations:23.2.1'

Expand All @@ -45,6 +54,44 @@ dependencies {
testCompile 'org.easytesting:fest-assert-core:2.0M10'

}
jacoco {
toolVersion = "0.7.9"
}

task codeCoverageReport(type: JacocoReport, dependsOn: ["testDebug"]) {

group = "Reporting"
description = "Generate Jacoco coverage reports for Debug build"

reports {
xml.enabled = true
xml.destination "${buildDir}/reports/jacoco/report.xml"
html.enabled = true
}

// what to exclude from coverage report
// UI, "noise", generated classes, platform classes, etc.
def excludes = [
'**/R.class',
'**/R$*.class',
'**/BuildConfig.*',
'**/Manifest*.*',
'**/*Test*.*',
'**/*Fragment.*',
'**/*Activity.*'
]
// generated classes
classDirectories = fileTree(
dir: "$buildDir/intermediates/classes/debug",
excludes: excludes
)

// sources
sourceDirectories = files([android.sourceSets.main.java.srcDirs])
executionData = files("$buildDir/jacoco/testDebug.exec")
}

apply from: 'https://raw.githubusercontent.com/shamanland/gradle-mvn-push/cc18d56549cdea03f744b6fff27911569394073e/gradle-mvn-push.gradle'



1 change: 0 additions & 1 deletion simple_sample/build.gradle
Expand Up @@ -21,5 +21,4 @@ android {

dependencies {
compile project(':lib')
compile fileTree(dir: 'libs', include: ['*.jar'])
}
1 change: 0 additions & 1 deletion styled_sample/build.gradle
Expand Up @@ -21,5 +21,4 @@ android {

dependencies {
compile project(':lib')
compile fileTree(dir: 'libs', include: ['*.jar'])
}

0 comments on commit 8609f07

Please sign in to comment.