2014-11-17 13:35:15 -05:00
|
|
|
apply plugin: 'java'
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
apply plugin: 'jacoco'
|
2014-11-17 16:49:10 -05:00
|
|
|
apply plugin: 'com.github.kt3k.coveralls'
|
|
|
|
|
2014-12-05 23:35:59 -05:00
|
|
|
evaluationDependsOn(":app")
|
2014-11-20 00:52:42 -05:00
|
|
|
|
2014-11-17 16:49:10 -05:00
|
|
|
buildscript {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2014-11-17 21:58:23 -05:00
|
|
|
// Version lock for https://github.com/kt3k/coveralls-gradle-plugin/issues/27
|
|
|
|
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1x'
|
2014-11-17 16:49:10 -05:00
|
|
|
}
|
|
|
|
}
|
2014-11-17 13:35:15 -05:00
|
|
|
|
2014-11-20 23:58:26 -05:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
url 'http://repository.jetbrains.com/repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-05 01:45:21 -05:00
|
|
|
// TODO: Make sure we test against the Debug variant
|
2014-11-17 13:35:15 -05:00
|
|
|
def androidModule = project(':app')
|
2014-11-17 14:09:44 -05:00
|
|
|
def firstVariant = androidModule.android.applicationVariants.toList().first()
|
2014-11-17 13:35:15 -05:00
|
|
|
|
2014-12-05 22:39:30 -05:00
|
|
|
// TODO: Not yet including Spek tests, fix that.
|
|
|
|
def testIncludes = [
|
|
|
|
'**/*Test.class'
|
|
|
|
]
|
|
|
|
def jacocoExcludes = [
|
|
|
|
'android/**',
|
|
|
|
'com/todddavies/**',
|
|
|
|
'com/cmwmobile/**',
|
|
|
|
'org/bspeice/minimalbible/R*',
|
|
|
|
'**/*$$*'
|
|
|
|
]
|
|
|
|
|
2014-11-17 13:35:15 -05:00
|
|
|
dependencies {
|
|
|
|
compile androidModule
|
|
|
|
|
2014-11-20 00:52:42 -05:00
|
|
|
testCompile 'junit:junit:4.+'
|
|
|
|
testCompile 'org.robolectric:robolectric:+'
|
2014-11-21 18:24:24 -05:00
|
|
|
testCompile 'org.mockito:mockito-core:+'
|
2014-11-20 00:52:42 -05:00
|
|
|
testCompile 'com.jayway.awaitility:awaitility:+'
|
2014-11-20 23:58:26 -05:00
|
|
|
testCompile 'org.jetbrains.spek:spek:+'
|
2014-11-20 00:52:42 -05:00
|
|
|
|
2014-11-17 14:09:44 -05:00
|
|
|
testCompile firstVariant.javaCompile.classpath
|
|
|
|
testCompile firstVariant.javaCompile.outputs.files
|
2014-11-17 13:35:15 -05:00
|
|
|
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
|
|
|
|
}
|
|
|
|
|
2014-12-05 22:39:30 -05:00
|
|
|
def buildExcludeTree(path, excludes) {
|
|
|
|
def tree = fileTree(path).exclude(excludes)
|
|
|
|
tree
|
|
|
|
}
|
2014-11-17 15:36:42 -05:00
|
|
|
|
2014-12-05 22:39:30 -05:00
|
|
|
jacocoTestReport {
|
2014-11-17 15:36:42 -05:00
|
|
|
doFirst {
|
2014-12-05 22:39:30 -05:00
|
|
|
// First we build a list of our base directories
|
|
|
|
def fileList = new ArrayList<String>()
|
|
|
|
def outputsList = firstVariant.javaCompile.outputs.files
|
|
|
|
outputsList.each { fileList.add(it.absolutePath.toString()) }
|
|
|
|
|
|
|
|
// And build a fileTree from those
|
|
|
|
def outputTree = fileList.inject { tree1, tree2 ->
|
|
|
|
buildExcludeTree(tree1, jacocoExcludes) +
|
|
|
|
buildExcludeTree(tree2, jacocoExcludes)
|
|
|
|
}
|
|
|
|
|
|
|
|
// And finally tell Jacoco to only include said files in the report
|
|
|
|
classDirectories = outputTree
|
2014-11-17 13:35:15 -05:00
|
|
|
}
|
2014-12-05 23:04:14 -05:00
|
|
|
|
|
|
|
reports {
|
|
|
|
xml.enabled true
|
|
|
|
}
|
2014-11-17 13:35:15 -05:00
|
|
|
}
|
2014-11-17 17:11:41 -05:00
|
|
|
|
2014-12-05 23:30:45 -05:00
|
|
|
coveralls {
|
|
|
|
sourceDirs = files(androidModule.android.sourceSets.main.java.srcDirs).files.absolutePath
|
|
|
|
}
|
|
|
|
|
2014-11-20 00:52:42 -05:00
|
|
|
tasks.withType(Test) {
|
|
|
|
scanForTestClasses = false
|
2014-12-05 22:39:30 -05:00
|
|
|
includes = testIncludes
|
|
|
|
}
|