build: 集成依赖更新检查与自动升级工具

- 添加 ben-manes/gradle-versions-plugin(0.54.0)用于检测依赖更新
- 添加 nl.littlerobots/version-catalog-update(1.1.0)用于自动升级版本目录
- 升级 Compose BOM 2025.05.01 → 2026.05.01
- 升级 profileinstaller 1.4.0 → 1.4.1
- 版本目录按字母顺序重新排序

使用方式:
  ./gradlew dependencyUpdates       # 检查更新
  ./gradlew versionCatalogUpdate    # 自动升级版本号

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-22 17:31:23 +08:00
parent 1be1948f49
commit 5acad54384
2 changed files with 28 additions and 20 deletions

View File

@ -5,6 +5,8 @@ plugins {
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) alias(libs.plugins.spotless)
alias(libs.plugins.versions)
alias(libs.plugins.catalogUpdate)
} }
spotless { spotless {
@ -22,3 +24,6 @@ spotless {
endWithNewline() endWithNewline()
} }
} }
// versionCatalogUpdate 配置见 https://github.com/littlerobots/version-catalog-update-plugin
// 注意:运行该任务会重写 gradle/libs.versions.toml非依赖版本键需手动保留

View File

@ -1,6 +1,5 @@
[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"
@ -8,44 +7,48 @@ androidx-activity = "1.13.0"
androidx-espresso = "3.7.0" androidx-espresso = "3.7.0"
androidx-lifecycle = "2.10.0" androidx-lifecycle = "2.10.0"
androidx-testExt = "1.3.0" androidx-testExt = "1.3.0"
composeBom = "2025.05.01" androidx-uiautomator = "2.3.0"
junit = "4.13.2" benchmarkMacro = "1.4.1"
catalogUpdate = "1.1.0"
composeBom = "2026.05.01"
kotlin = "2.3.21" kotlin = "2.3.21"
kotlinx-datetime = "0.8.0" kotlinx-datetime = "0.8.0"
tyme4kt = "1.4.5" profileinstaller = "1.4.1"
sketch = "4.4.0" sketch = "4.4.0"
profileinstaller = "1.4.0" spotless = "8.5.1"
benchmarkMacro = "1.4.1" tyme4kt = "1.4.5"
androidx-uiautomator = "2.3.0" versions = "0.54.0"
[libraries] [libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" }
androidx-lifecycle-viewmodelCompose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" } androidx-benchmark-macro = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmarkMacro" }
androidx-lifecycle-runtimeCompose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" } androidx-lifecycle-runtimeCompose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "androidx-lifecycle" }
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" } androidx-lifecycle-viewmodelCompose = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "androidx-lifecycle" }
compose-runtime = { module = "androidx.compose.runtime:runtime" } androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" }
androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" }
androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "androidx-uiautomator" }
compose-animation = { module = "androidx.compose.animation:animation" } compose-animation = { module = "androidx.compose.animation:animation" }
compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
compose-foundation = { module = "androidx.compose.foundation:foundation" } compose-foundation = { module = "androidx.compose.foundation:foundation" }
compose-material3 = { module = "androidx.compose.material3:material3" } compose-material3 = { module = "androidx.compose.material3:material3" }
compose-runtime = { module = "androidx.compose.runtime:runtime" }
compose-ui = { module = "androidx.compose.ui:ui" } compose-ui = { module = "androidx.compose.ui:ui" }
compose-uiTooling = { module = "androidx.compose.ui:ui-tooling" } compose-uiTooling = { module = "androidx.compose.ui:ui-tooling" }
compose-uiToolingPreview = { module = "androidx.compose.ui:ui-tooling-preview" } compose-uiToolingPreview = { module = "androidx.compose.ui:ui-tooling-preview" }
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlinx-coroutines-test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0"
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" } kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version = "1.11.0" }
tyme4kt = { module = "cn.6tail:tyme4kt", version.ref = "tyme4kt" }
sketch-compose = { module = "io.github.panpf.sketch4:sketch-compose", version.ref = "sketch" }
sketch-animated-gif = { module = "io.github.panpf.sketch4:sketch-animated-gif", version.ref = "sketch" } sketch-animated-gif = { module = "io.github.panpf.sketch4:sketch-animated-gif", version.ref = "sketch" }
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" } sketch-compose = { module = "io.github.panpf.sketch4:sketch-compose", version.ref = "sketch" }
androidx-benchmark-macro = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmarkMacro" } tyme4kt = { module = "cn.6tail:tyme4kt", version.ref = "tyme4kt" }
androidx-test-ext-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" }
androidx-test-espresso = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "androidx-uiautomator" }
[plugins] [plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" } androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" } androidLibrary = { id = "com.android.library", version.ref = "agp" }
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" }
catalogUpdate = { id = "nl.littlerobots.version-catalog-update", version.ref = "catalogUpdate" }
composeCompiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
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" } spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }