-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
105 lines (90 loc) · 3.2 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
import io.gitlab.arturbosch.detekt.Detekt
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
repositories {
mavenCentral()
jcenter()
}
plugins {
id(Plugins.KOTLIN) version Versions.KOTLIN_VERSION
kotlin(Plugins.KAPT) version Versions.KOTLIN_VERSION
id(Plugins.DETEKT) version Versions.DETEKT_VERSION
}
apply(from = "config/git-hooks/gitHooks.gradle.kts")
detekt {
failFast = false
buildUponDefaultConfig = true
config = files("$projectDir/config/detekt/detekt.yml")
reports {
html.enabled = true
xml.enabled = true
txt.enabled = true
}
}
group "com.greyhairredbear"
version "1.0"
java.sourceCompatibility = JavaVersion.VERSION_11
dependencies {
implementation(Core.STD_LIB)
implementation(Core.KOTLINX_COROUTINES)
testImplementation(Testing.KOTEST_RUNNER)
testImplementation(Testing.KOTEST_JUNIT_RUNNER)
testImplementation(Testing.KOTEST_ASSERTIONS)
testImplementation(Testing.KOTEST_PROPERTIES)
testImplementation(Testing.MOCKK)
testImplementation(Testing.KOTLINX_COROUTINES_TEST)
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "1.8"
}
}
tasks.withType<Detekt> {
this.jvmTarget = "1.8"
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
// set options for log level DEBUG and INFO
debug {
events = setOf(
TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
)
exceptionFormat = TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {}
override fun afterSuite(desc: TestDescriptor, result: TestResult) {
if (desc.parent == null) {
val output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
val startItem = "| "
val endItem = " |"
val repeatLength = startItem.length + output.length + endItem.length
println("\n${"-".repeat(repeatLength)}\n$startItem$output$endItem\n + ${"-".repeat(repeatLength)}")
}
}
})
}
}