Merge pull request #6702 from thundernest/add-dependency-updates-build-plugin
Add dependency check build plugin
This commit is contained in:
commit
a024735d1e
5 changed files with 23 additions and 0 deletions
|
@ -27,6 +27,8 @@ The plugins should try to accomplish single responsibility and leave one-off con
|
|||
|
||||
## Supportive plugins
|
||||
|
||||
- `thunderbird.dependency.check` - [Gradle Versions: Gradle plugin to discover dependency updates](https://github.com/ben-manes/gradle-versions-plugin)
|
||||
- Use `./gradlew dependencyUpdates` to generate a dependency update report
|
||||
- `thunderbird.quality.detekt` - [Detekt - Static code analysis for Kotlin ](https://detekt.dev/)
|
||||
- Use `./gradlew detekt` to check for any issue and `./gradlew detektBaseline` in case you can't fix the reported
|
||||
issue.
|
||||
|
|
|
@ -13,6 +13,7 @@ dependencies {
|
|||
|
||||
implementation(plugin(libs.plugins.spotless))
|
||||
implementation(plugin(libs.plugins.detekt))
|
||||
implementation(plugin(libs.plugins.dependency.check))
|
||||
}
|
||||
|
||||
fun plugin(provider: Provider<PluginDependency>) = with(provider.get()) {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
||||
|
||||
plugins {
|
||||
id("com.github.ben-manes.versions")
|
||||
}
|
||||
|
||||
tasks.withType<DependencyUpdatesTask> {
|
||||
rejectVersionIf {
|
||||
isNonStable(candidate.version) && !isNonStable(currentVersion)
|
||||
}
|
||||
}
|
||||
|
||||
fun isNonStable(version: String): Boolean {
|
||||
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
|
||||
val regex = "^[\\d,.v-]+(-r)?$".toRegex()
|
||||
val isStable = stableKeyword || regex.matches(version)
|
||||
return isStable.not()
|
||||
}
|
|
@ -12,6 +12,7 @@ plugins {
|
|||
|
||||
id("thunderbird.quality.spotless")
|
||||
id("thunderbird.quality.detekt")
|
||||
id("thunderbird.dependency.check")
|
||||
}
|
||||
|
||||
val propertyTestCoverage: String? by extra
|
||||
|
|
|
@ -42,6 +42,7 @@ kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref =
|
|||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
spotless = "com.diffplug.spotless:6.14.0"
|
||||
detekt = "io.gitlab.arturbosch.detekt:1.22.0"
|
||||
dependency-check = "com.github.ben-manes.versions:0.46.0"
|
||||
|
||||
[libraries]
|
||||
desugar = "com.android.tools:desugar_jdk_libs:1.1.8"
|
||||
|
|
Loading…
Reference in a new issue