39 lines
1.2 KiB
Kotlin
39 lines
1.2 KiB
Kotlin
val ktlint by configurations.creating
|
|
|
|
dependencies {
|
|
ktlint("com.pinterest:ktlint:0.49.1") {
|
|
attributes {
|
|
attribute(Bundling.BUNDLING_ATTRIBUTE, objects.named(Bundling.EXTERNAL))
|
|
}
|
|
}
|
|
// ktlint(project(":custom-ktlint-ruleset")) // in case of custom ruleset
|
|
}
|
|
|
|
val ktlintCheck by tasks.registering(JavaExec::class) {
|
|
group = LifecycleBasePlugin.VERIFICATION_GROUP
|
|
description = "Check Kotlin code style"
|
|
classpath = ktlint
|
|
mainClass.set("com.pinterest.ktlint.Main")
|
|
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
|
|
args(
|
|
"**/*.kt",
|
|
"**/*.kts",
|
|
"!**/build/**",
|
|
)
|
|
}
|
|
|
|
val ktlintFormat by tasks.registering(JavaExec::class) {
|
|
group = LifecycleBasePlugin.VERIFICATION_GROUP
|
|
description = "Check Kotlin code style and format"
|
|
classpath = ktlint
|
|
mainClass.set("com.pinterest.ktlint.Main")
|
|
jvmArgs("--add-opens=java.base/java.lang=ALL-UNNAMED")
|
|
// see https://pinterest.github.io/ktlint/install/cli/#command-line-usage for more information
|
|
args(
|
|
"-F",
|
|
"**/*.kt",
|
|
"**/*.kts",
|
|
"!**/build/**",
|
|
)
|
|
}
|