Add common configuration for kotlin modules.

This commit is contained in:
Yahor Berdnikau 2018-10-06 13:37:12 +02:00
parent 4c0e55ccdd
commit 8f65b37605
6 changed files with 61 additions and 105 deletions

View File

@ -25,7 +25,7 @@ jobs:
- run:
name: unit-tests
command: |
./gradlew :subsonic-api:test :cache:test :subsonic-api-image-loader:testDebugUnitTest :ultrasonic:testDebugUnitTest
./gradlew ciTest :ultrasonic:testDebugUnitTest
./gradlew jacocoFullReport
bash <(curl -s https://codecov.io/bash)
- run:

View File

@ -2,6 +2,10 @@
buildscript {
apply from: 'dependencies.gradle'
ext.bootstrap = [
kotlinModule : "${project.rootDir}/gradle_scripts/kotlin-module-bootstrap.gradle",
]
repositories {
jcenter()
google()

35
cache/build.gradle vendored
View File

@ -1,11 +1,7 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply from: '../gradle_scripts/code_quality.gradle'
apply from: bootstrap.kotlinModule
dependencies {
api project(':domain')
api other.kotlinStdlib
api other.twitterSerial
testImplementation testing.junit
@ -15,32 +11,3 @@ dependencies {
testImplementation testing.mockitoKotlin
testImplementation testing.kluent
}
jacoco {
toolVersion(versions.jacoco)
}
ext {
jacocoExclude = []
}
jacocoTestReport {
reports {
html.enabled true
csv.enabled false
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: jacocoExclude)
})
}
}
test.finalizedBy jacocoTestReport
test {
jacoco {
excludes += jacocoExclude
}
}

View File

@ -1,38 +1,5 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply from: '../gradle_scripts/code_quality.gradle'
apply from: bootstrap.kotlinModule
dependencies {
api other.kotlinStdlib
api other.semver
}
jacoco {
toolVersion(versions.jacoco)
}
ext {
jacocoExclude = []
}
jacocoTestReport {
reports {
html.enabled true
csv.enabled false
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: jacocoExclude)
})
}
}
test.finalizedBy jacocoTestReport
test {
jacoco {
excludes += jacocoExclude
}
}

View File

@ -0,0 +1,53 @@
apply plugin: 'java-library'
apply plugin: 'kotlin'
apply plugin: 'jacoco'
apply from: "${project.rootDir}/gradle_scripts/code_quality.gradle"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets {
main.java.srcDirs += "${projectDir}/src/main/kotlin"
test.java.srcDirs += "${projectDir}/src/test/kotlin"
test.java.srcDirs += "${projectDir}/src/integrationTest/kotlin"
test.resources.srcDirs += "${projectDir}/src/integrationTest/resources"
}
dependencies {
api other.kotlinStdlib
}
jacoco {
toolVersion(versions.jacoco)
}
ext {
// override it in the module
jacocoExclude = []
}
jacocoTestReport {
reports {
html.enabled true
csv.enabled false
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: jacocoExclude)
})
}
}
test.finalizedBy jacocoTestReport
test {
jacoco {
excludes += jacocoExclude
}
}
task("ciTest", dependsOn: "test") {
group = "Verification"
description = "Special task for CI that calls all tests in pure kotlin modules"
}

View File

@ -1,16 +1,6 @@
apply plugin: 'kotlin'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply from: '../gradle_scripts/code_quality.gradle'
sourceSets {
main.java.srcDirs += "${projectDir}/src/main/kotlin"
test.java.srcDirs += "${projectDir}/src/integrationTest/kotlin"
test.resources.srcDirs += "${projectDir}/src/integrationTest/resources"
}
apply from: bootstrap.kotlinModule
dependencies {
api other.kotlinStdlib
api other.retrofit
api other.jacksonConverter
api other.koinCore
@ -31,10 +21,6 @@ dependencies {
testImplementation testing.apacheCodecs
}
jacoco {
toolVersion(versions.jacoco)
}
ext {
// Excluding data classes
jacocoExclude = [
@ -42,24 +28,3 @@ ext {
'**/di/**'
]
}
jacocoTestReport {
reports {
html.enabled true
csv.enabled false
xml.enabled true
}
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(dir: it, excludes: jacocoExclude)
})
}
}
test.finalizedBy jacocoTestReport
test {
jacoco {
excludes += jacocoExclude
}
}