-
Notifications
You must be signed in to change notification settings - Fork 506
/
build.gradle.kts
72 lines (64 loc) · 1.81 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
import java.net.URI
plugins {
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.checksum) apply false
alias(libs.plugins.shadow) apply false
alias(
libs
.plugins
.kotlinx
.binary
.compatibiltiy
.validator,
)
}
val internalNonPublishableProjects by extra(
setOf(
"ktlint-api-consumer",
"ktlint-bom",
"ktlint-ruleset-template",
),
)
apiValidation {
ignoredProjects += internalNonPublishableProjects
}
val ktlint: Configuration by configurations.creating
dependencies {
ktlint(projects.ktlintCli)
}
tasks.register<JavaExec>("ktlintCheck") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style"
classpath = ktlint
mainClass = "com.pinterest.ktlint.Main"
args(
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
// Do not run with option "--log-level=debug" or "--log-level=trace" as the lint violations will be difficult
// to spot between the amount of output lines.
)
}
tasks.register<JavaExec>("ktlintFormat") {
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = "Check Kotlin code style and format"
classpath = ktlint
mainClass = "com.pinterest.ktlint.Main"
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
args(
"-F",
"**/src/**/*.kt",
"**.kts",
"!**/build/**",
// Do not run with option "--log-level=debug" or "--log-level=trace" as the lint violations will be difficult
// to spot between the amount of output lines.
)
}
tasks.wrapper {
distributionSha256Sum =
URI
.create("$distributionUrl.sha256")
.toURL()
.openStream()
.use { it.reader().readText().trim() }
}