-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
82 lines (70 loc) · 2.21 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
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version libs.versions.kotlin
`jvm-test-suite`
id("pods4k-code-generator")
alias(libs.plugins.spotless)
}
allprojects {
repositories {
mavenCentral()
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
// generate default methods in interfaces without the DefaultImpls
freeCompilerArgs.add("-Xjvm-default=all")
// enforce redundant visibility modifiers
kotlin.explicitApi()
// prevent warnings from compiling in non-test code
if (name != "compileTestKotlin") {
allWarningsAsErrors.set(true)
}
// experimental features
freeCompilerArgs.add("-XXLanguage:+CustomEqualsInValueClasses")
freeCompilerArgs.add("-opt-in=kotlin.experimental.ExperimentalTypeInference")
}
}
// Ensure "org.gradle.jvm.version" is set to "11" in Gradle metadata.
tasks.withType<JavaCompile> {
options.release.set(11)
}
plugins.withId("org.jetbrains.kotlin.jvm") {
dependencies {
testImplementation(libs.strikt)
testRuntimeOnly(libs.jUnitPlatformLauncher)
}
testing {
suites {
val test by getting(JvmTestSuite::class) {
useJUnitJupiter(libs.versions.jUnit)
}
}
}
}
}
val ktlintEditorConfigOverride = mapOf(
"ktlint_standard_discouraged-comment-location" to "disabled",
"ktlint_standard_value-argument-comment" to "disabled",
)
spotless {
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.*")
ktlint()
.editorConfigOverride(ktlintEditorConfigOverride)
trimTrailingWhitespace()
endWithNewline()
}
kotlinGradle {
target("**/*.gradle.kts")
ktlint()
.editorConfigOverride(ktlintEditorConfigOverride)
trimTrailingWhitespace()
endWithNewline()
}
}
tasks.named("generateCode").configure {
finalizedBy("spotlessApply")
}