build: 集成 Spotless 8.5.1 代码格式化工具
- 在版本目录中添加 spotless 插件 8.5.1 - 配置 Kotlin 源码和 Gradle Kotlin DSL 脚本格式化 - 使用 ktlint 引擎,启用 trimTrailingWhitespace 和 endWithNewline Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
dd072730f1
commit
1be1948f49
@ -4,4 +4,21 @@ plugins {
|
|||||||
alias(libs.plugins.androidApplication) apply false
|
alias(libs.plugins.androidApplication) apply false
|
||||||
alias(libs.plugins.androidLibrary) apply false
|
alias(libs.plugins.androidLibrary) apply false
|
||||||
alias(libs.plugins.composeCompiler) apply false
|
alias(libs.plugins.composeCompiler) apply false
|
||||||
}
|
alias(libs.plugins.spotless)
|
||||||
|
}
|
||||||
|
|
||||||
|
spotless {
|
||||||
|
kotlin {
|
||||||
|
target("src/**/*.kt")
|
||||||
|
targetExclude("${layout.buildDirectory}/**/*.kt")
|
||||||
|
ktlint()
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
kotlinGradle {
|
||||||
|
target("*.gradle.kts")
|
||||||
|
ktlint()
|
||||||
|
trimTrailingWhitespace()
|
||||||
|
endWithNewline()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
[versions]
|
[versions]
|
||||||
agp = "9.2.1"
|
agp = "9.2.1"
|
||||||
|
spotless = "8.5.1"
|
||||||
android-compileSdk = "37"
|
android-compileSdk = "37"
|
||||||
android-minSdk = "24"
|
android-minSdk = "24"
|
||||||
android-targetSdk = "37"
|
android-targetSdk = "37"
|
||||||
@ -47,3 +48,4 @@ androidLibrary = { id = "com.android.library", version.ref = "agp" }
|
|||||||
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
androidTest = { id = "com.android.test", version.ref = "agp" }
|
androidTest = { id = "com.android.test", version.ref = "agp" }
|
||||||
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
|
||||||
|
|||||||
@ -30,4 +30,4 @@ dependencyResolutionManagement {
|
|||||||
|
|
||||||
include(":core")
|
include(":core")
|
||||||
include(":app")
|
include(":app")
|
||||||
include(":macrobenchmark")
|
include(":macrobenchmark")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user