Skip to content

Commit

Permalink
Add jacoco test & ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
nekocode committed Feb 1, 2019
1 parent 43cbe81 commit f6c0248
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: android
jdk: oraclejdk8
script: ./gradlew check

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

android:
components:
- android-28
- build-tools-28.0.3

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/

cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
29 changes: 28 additions & 1 deletion meepo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
apply plugin: "com.android.library"
apply plugin: "com.github.dcendents.android-maven"
apply plugin: "kotlin-android"
apply plugin: "com.github.dcendents.android-maven"
apply plugin: "jacoco"

android {
compileSdkVersion 28
Expand All @@ -23,6 +24,32 @@ dependencies {
testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.20"
}

task jacocoTestReport(type: JacocoReport, dependsOn: "testReleaseUnitTest") {
reports {
xml.enabled = true
html.enabled = true
}

def fileFilter = [
"**/R.class",
'**/R$*.class',
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*"
]
def classTree = fileTree(dir: "${buildDir}/intermediates/javac", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories = files([mainSrc])
classDirectories = files([classTree])
executionData = files("${buildDir}/jacoco/testReleaseUnitTest.exec")
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
check.dependsOn jacocoTestReport

task androidSourcesJar(type: Jar) {
classifier = "sources"
baseName = archivesBaseName
Expand Down

0 comments on commit f6c0248

Please sign in to comment.