-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
93 lines (87 loc) · 3.38 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
// Copyright 2024 Ji Sungbin
// SPDX-License-Identifier: Apache-2.0
import com.diffplug.gradle.spotless.BaseKotlinExtension
import com.diffplug.gradle.spotless.SpotlessExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
alias(libs.plugins.andriod.application) apply false
kotlin("android") version libs.versions.kotlin.asProvider() apply false
kotlin("jvm") version libs.versions.kotlin.asProvider() apply false
kotlin("plugin.compose") version libs.versions.kotlin.asProvider() apply false
alias(libs.plugins.kotlin.ksp) apply false
alias(libs.plugins.kotlin.poko) apply false
alias(libs.plugins.spotless)
}
allprojects {
apply {
plugin(rootProject.libs.plugins.spotless.get().pluginId)
}
extensions.configure<SpotlessExtension> {
fun BaseKotlinExtension.useKtlint() {
ktlint(rootProject.libs.versions.ktlint.get()).editorConfigOverride(
mapOf(
"indent_size" to "2",
"ktlint_standard_filename" to "disabled",
"ktlint_standard_package-name" to "disabled",
"ktlint_standard_function-naming" to "disabled",
"ktlint_standard_property-naming" to "disabled",
"ktlint_standard_backing-property-naming" to "disabled",
"ktlint_standard_class-signature" to "disabled",
"ktlint_standard_function-signature" to "disabled",
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_standard_blank-line-before-declaration" to "disabled",
"ktlint_standard_spacing-between-declarations-with-annotations" to "disabled",
"ktlint_standard_import-ordering" to "disabled",
"ktlint_standard_max-line-length" to "disabled",
"ktlint_standard_annotation" to "disabled",
"ktlint_standard_multiline-if-else" to "disabled",
"ktlint_standard_value-argument-comment" to "disabled",
"ktlint_standard_value-parameter-comment" to "disabled",
"ktlint_standard_comment-wrapping" to "disabled",
),
)
}
kotlin {
target("**/*.kt")
targetExclude("**/build/**/*.kt", "spotless/*.kt")
useKtlint()
licenseHeaderFile(rootProject.file("spotless/copyright.kt"))
}
kotlinGradle {
target("**/*.kts")
targetExclude("**/build/**/*.kts", "spotless/*.kts")
useKtlint()
licenseHeaderFile(
rootProject.file("spotless/copyright.kts"),
"(@file|import|plugins|buildscript|dependencies|pluginManagement|dependencyResolutionManagement)",
)
}
format("xml") {
target("**/*.xml")
targetExclude("**/build/**/*.xml", "spotless/*.xml", ".idea/**/*.xml")
licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")
}
}
}
subprojects {
tasks.withType<KotlinCompile> {
compilerOptions {
optIn.addAll(
"kotlin.OptIn",
"kotlin.RequiresOptIn",
"kotlin.contracts.ExperimentalContracts",
"kotlinx.coroutines.ExperimentalCoroutinesApi",
)
}
}
tasks.withType<Test> {
useJUnitPlatform()
// https://junit.org/junit5/docs/snapshot/user-guide/#writing-tests-parallel-execution
systemProperties = mapOf(
"junit.jupiter.execution.parallel.enabled" to "true",
"junit.jupiter.execution.parallel.mode.default" to "concurrent",
"junit.jupiter.execution.parallel.mode.classes.default" to "concurrent",
)
outputs.upToDateWhen { false }
}
}