-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
90 lines (79 loc) · 2.64 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.spotless) apply true
alias(libs.plugins.plantuml) apply true
alias(libs.plugins.kotlin.jvm) apply true
}
val jvmVersion = libs.versions.jvm.get()
allprojects {
apply(plugin = "com.diffplug.spotless")
apply(plugin = "io.github.redgreencoding.plantuml")
apply(plugin = "org.jetbrains.kotlin.jvm")
tasks.withType(KotlinCompile::class.java) {
kotlinOptions {
jvmTarget = jvmVersion
}
}
repositories {
mavenLocal()
mavenCentral()
}
spotless {
kotlin {
target(
fileTree("${project.rootDir}/$name") {
include("**/*.kt")
},
)
// see https://github.com/shyiko/ktlint#standard-rules
trimTrailingWhitespace()
ktlint("1.0.1").editorConfigOverride(
mapOf(
"ktlint_standard_package-name" to "disabled",
"ktlint_standard_enum-entry-name-case" to "disabled",
"ktlint_standard_trailing-comma" to "disabled",
"ktlint_standard_annotation" to "disabled",
"ktlint_standard_no-unused-imports" to "disabled",
"ktlint_standard_trailing-comma-on-call-site" to "disabled",
"ktlint_standard_trailing-comma-on-declaration-site" to "disabled",
),
)
diktat("1.2.3").configFile("${rootProject.rootDir}/config/diktat/diktat-analysis.yml")
}
kotlinGradle {
target(
fileTree(".") {
include("**/*.gradle.kts")
},
)
trimTrailingWhitespace()
indentWithTabs(2)
indentWithSpaces(4)
endWithNewline()
ktlint()
}
}
plantuml {
options {
outputDir = project.file("etc")
format = "svg"
}
diagrams {
create(project.name) {
sourceFile =
project.file("$projectDir/etc/${project.name}.puml")
}
}
}
val tasksDependencies =
mapOf(
"spotlessKotlin" to listOf("spotlessKotlinGradle", "compileKotlin", "compileTestKotlin", "test"),
"spotlessKotlinGradle" to listOf("compileKotlin", "compileTestKotlin", "test"),
)
tasks.named("spotlessKotlin") {
mustRunAfter("compileKotlin")
}
tasksDependencies.forEach { (task, dependOn) ->
dependOn.forEach { tasks.findByName(task)!!.dependsOn(it) }
}
}