/
module.gradle.kts
78 lines (68 loc) · 2.17 KB
/
module.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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("packaging")
kotlin("jvm")
`maven-publish`
jacoco
}
// bundle detekt's version for all jars to use it at runtime
tasks.withType<Jar>().configureEach {
manifest {
attributes(mapOf("DetektVersion" to Versions.DETEKT))
}
}
val versionCatalog = project.extensions.getByType<VersionCatalogsExtension>().named("libs")
jacoco.toolVersion = versionCatalog.findVersion("jacoco").get().requiredVersion
tasks.withType<PublishToMavenRepository>().configureEach {
notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13468")
}
tasks.withType<Test>().configureEach {
useJUnitPlatform()
systemProperty("junit.jupiter.testinstance.lifecycle.default", "per_class")
val compileSnippetText: Boolean = if (project.hasProperty("compile-test-snippets")) {
(project.property("compile-test-snippets") as String).toBoolean()
} else {
false
}
systemProperty("compile-snippet-tests", compileSnippetText)
testLogging {
// set options for log level LIFECYCLE
events = setOf(
TestLogEvent.FAILED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT,
TestLogEvent.SKIPPED
)
exceptionFormat = TestExceptionFormat.FULL
showExceptions = true
showCauses = true
showStackTraces = true
}
}
tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = Versions.JVM_TARGET
freeCompilerArgs += listOf(
"-progressive",
)
allWarningsAsErrors = project.findProperty("warningsAsErrors") == "true"
}
}
testing {
suites {
getByName("test", JvmTestSuite::class) {
useJUnitJupiter(versionCatalog.findVersion("junit").get().requiredVersion)
}
}
}
dependencies {
compileOnly(kotlin("stdlib-jdk8"))
}
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}