-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
122 lines (110 loc) · 3.07 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
import Build_gradle.Version.ASSERTJ_VERSION
import Build_gradle.Version.KOIN_VERSION
import Build_gradle.Version.LOGBACK_VERSION
import Build_gradle.Version.TESTNG_VERSION
import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.JavaVersion.VERSION_11
object Version {
const val KOTLIN_VERSION = "1.3.70"
const val KOIN_VERSION = "2.1.4"
const val LOGBACK_VERSION = "1.2.3"
const val TESTNG_VERSION = "7.1.0"
const val ASSERTJ_VERSION = "3.12.2"
}
val jacocoMinCoverage = "0.9"
val jacocoExcludedClasses = listOf("**/*/Application*")
plugins {
kotlin("jvm") version "1.3.70"
id("io.gitlab.arturbosch.detekt") version "1.6.0"
application
jacoco
}
group = "com.mastrodaro"
version = "1.0-SNAPSHOT"
application {
mainClassName = "com.mastrodaro.example.ApplicationKt"
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.koin", "koin-core", KOIN_VERSION)
implementation("ch.qos.logback", "logback-classic", LOGBACK_VERSION)
testImplementation("org.testng", "testng", TESTNG_VERSION)
testImplementation("org.assertj", "assertj-core", ASSERTJ_VERSION)
testImplementation("org.koin", "koin-test", KOIN_VERSION)
}
configure<JavaPluginConvention> {
sourceCompatibility = VERSION_11
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
withType<Detekt> {
this.jvmTarget = "11"
}
test {
useTestNG()
dependsOn(":detekt")
jacoco
finalizedBy(jacocoTestCoverageVerification)
finalizedBy(jacocoTestReport)
}
jacocoTestReport {
reports {
xml.isEnabled = true
xml.destination = file("$buildDir/reports/coverage/coverage.xml")
csv.isEnabled = false
html.isEnabled = true
html.destination = file("$buildDir/reports/coverage/html")
}
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude(jacocoExcludedClasses)
}
)
}
jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = jacocoMinCoverage.toBigDecimal()
}
}
}
classDirectories.setFrom(
sourceSets.main.get().output.asFileTree.matching {
exclude(jacocoExcludedClasses)
}
)
}
}
sourceSets {
main {
resources {
exclude("detekt-config.yml")
}
}
}
tasks.register<Jar>("fatJar") {
manifest {
attributes(
"Main-Class" to application.mainClassName
)
}
from(sourceSets.main.get().output)
dependsOn(configurations.runtimeClasspath)
from({
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
})
}
detekt {
input = files("src/main/kotlin", "src/test/kotlin")
config = files("src/main/resources/detekt-config.yml")
}