Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Coverage: jacoco+codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
g4s8 committed Mar 3, 2017
1 parent d059d3d commit fa491df
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 4 deletions.
7 changes: 7 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coverage:
range: 80..100
round: down
precision: 2

ignore:
- "**/R.java"
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ android:
- 'tools'
- 'build-tools-25.0.2'
- 'android-25'
- 'extra-android-m2repository'

jdk:
- 'oraclejdk8'
Expand All @@ -21,10 +22,10 @@ cache:
- '$HOME/.gradle/caches/'
- '$HOME/.gradle/wrapper/'

#after_success:
# - './gradlew jacocoReport'
# - 'bash <(curl -s https://codecov.io/bash)'
#
after_success:
- './gradlew jacocoReport'
- 'bash <(curl -s https://codecov.io/bash)'

#deploy:
# provider: 'script'
# script: './gradlew bintrayUpload'
Expand Down
52 changes: 52 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.g4s8.quanta'
apply plugin: 'jacoco'

configurations {
javadocDeps
Expand All @@ -18,12 +19,26 @@ android {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

testOptions {
unitTests.all {
jacoco {
includeNoLocationClasses = true
}
}
}
}

task sourcesJar(type: Jar) {
Expand All @@ -42,6 +57,43 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
}

task jacocoReport(type: JacocoReport) {
group = 'Reporting'
description = 'Generate Jacoco coverage reports after running tests.'

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

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

sourceDirectories = files('src/main/java')
executionData = files('build/jacoco/testDebugUnitTest.exec')

doFirst {
files('build/intermediates/classes/debug').getFiles().each { file ->
if (file.name.contains('$$')) {
file.renameTo(file.path.replace('$$', '$'))
}
}
}
}

artifacts {
archives javadocJar
archives sourcesJar
Expand Down

0 comments on commit fa491df

Please sign in to comment.