mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
66 lines
2.1 KiB
Groovy
66 lines
2.1 KiB
Groovy
apply plugin: 'java'
|
|
apply plugin: 'kotlin'
|
|
apply plugin: 'jacoco'
|
|
apply plugin: 'com.github.kt3k.coveralls'
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
// Version lock for https://github.com/kt3k/coveralls-gradle-plugin/issues/27
|
|
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1x'
|
|
}
|
|
}
|
|
|
|
def androidModule = project(':app')
|
|
def firstAppVariant = androidModule.android.applicationVariants.toList().first()
|
|
//def firstTestVariant = androidModule.android.testVariants.toList().first()
|
|
|
|
dependencies {
|
|
compile androidModule
|
|
|
|
testCompile firstAppVariant.javaCompile.classpath
|
|
testCompile firstAppVariant.javaCompile.outputs.files
|
|
//testCompile firstTestVariant.javaCompile.outputs.files
|
|
testCompile files(androidModule.plugins.findPlugin("com.android.application").getBootClasspath())
|
|
|
|
testCompile 'junit:junit:4.+'
|
|
testCompile 'org.mockito:mockito-all:+'
|
|
testCompile 'org.robolectric:robolectric:+'
|
|
}
|
|
|
|
jacocoTestReport {
|
|
/*
|
|
Alright, setting up Jacoco the right way is massively confusing.
|
|
Normally, you'd use something like additionalClassDirs to add the folders you need.
|
|
However, we want to exclude the android/ folder, and likely will need something else
|
|
in the future. In order to do this though, we need the doFirst block. See SO here:
|
|
http://stackoverflow.com/a/17411305/1454178
|
|
|
|
Additionally, to properly exclude, we need to run that code outside the doFirst block.
|
|
No clue why this is, but please don't change this without extensive testing.
|
|
*/
|
|
def jacocoExcludes = [
|
|
"android/**/*"
|
|
]
|
|
firstAppVariant.javaCompile.exclude(jacocoExcludes).outputs.files
|
|
|
|
doFirst {
|
|
sourceDirectories = files(androidModule.android.sourceSets.main.java.srcDirs)
|
|
classDirectories = firstAppVariant.javaCompile.outputs.files
|
|
}
|
|
|
|
// Back to your regularly scheduled Jacoco
|
|
reports {
|
|
xml.enabled true
|
|
csv.enabled false
|
|
html.destination "${buildDir}/jacocoHtml"
|
|
}
|
|
}
|
|
|
|
coveralls {
|
|
sourceDirs = files(androidModule.android.sourceSets.main.java.srcDirs).files.absolutePath
|
|
}
|