-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
68 lines (57 loc) · 1.39 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
@file:Suppress("UnstableApiUsage")
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import org.jlleitschuh.gradle.ktlint.KtlintPlugin
plugins {
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.shadow) apply false
alias(libs.plugins.jib) apply false
alias(libs.plugins.ktlint)
}
allprojects {
apply<JacocoPlugin>()
apply<KtlintPlugin>()
repositories {
mavenCentral()
}
task("preCommitHook") {
dependsOn(tasks.ktlintCheck)
}
extensions.configure<KtlintExtension> {
version = rootProject.libs.versions.ktlint.get()
enableExperimentalRules = false
coloredOutput = true
filter {
exclude {
it.file.absoluteFile.startsWith(layout.buildDirectory.asFile.get().absolutePath)
}
}
}
tasks.withType<KotlinCompile> {
compilerOptions {
allWarningsAsErrors.set(true)
}
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
events = setOf(
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.FAILED,
)
}
}
task("installPreCommitHook") {
delete(File(projectDir, ".git/hooks/pre-commit"))
copy {
from(File(projectDir, "pre-commit"))
into(File(projectDir, ".git/hooks"))
fileMode = 0b111101101
}
}
tasks.withType<Assemble> {
dependsOn("installPreCommitHook")
}