2021-04-27 09:53:47 +08:00
|
|
|
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
|
|
|
|
|
2021-01-08 16:19:25 +08:00
|
|
|
plugins {
|
2021-02-17 16:58:46 +08:00
|
|
|
run {
|
2021-03-05 14:12:53 +08:00
|
|
|
val kotlinVersion = "1.4.31"
|
2021-02-17 16:58:46 +08:00
|
|
|
kotlin("jvm") version kotlinVersion
|
|
|
|
kotlin("plugin.spring") version kotlinVersion
|
|
|
|
kotlin("kapt") version kotlinVersion
|
|
|
|
}
|
2021-03-05 14:12:53 +08:00
|
|
|
id("org.jlleitschuh.gradle.ktlint") version "10.0.0"
|
|
|
|
id("com.github.ben-manes.versions") version "0.38.0"
|
2021-01-08 16:19:25 +08:00
|
|
|
}
|
|
|
|
|
2021-04-27 09:53:47 +08:00
|
|
|
fun isNonStable(version: String): Boolean {
|
|
|
|
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
|
|
|
|
val unstableKeyword = listOf("ALPHA", "RC").any { version.toUpperCase().contains(it) }
|
|
|
|
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
|
|
|
|
val isStable = stableKeyword || regex.matches(version)
|
|
|
|
return unstableKeyword || !isStable
|
|
|
|
}
|
|
|
|
|
2021-01-08 16:27:21 +08:00
|
|
|
allprojects {
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
2021-02-17 16:58:46 +08:00
|
|
|
apply(plugin = "org.jlleitschuh.gradle.ktlint")
|
2021-03-05 14:12:53 +08:00
|
|
|
apply(plugin = "com.github.ben-manes.versions")
|
2021-04-27 09:53:47 +08:00
|
|
|
|
|
|
|
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
|
|
|
|
// disallow release candidates as upgradable versions from stable versions
|
|
|
|
rejectVersionIf {
|
|
|
|
isNonStable(candidate.version) && !isNonStable(currentVersion)
|
|
|
|
}
|
|
|
|
gradleReleaseChannel = "current"
|
|
|
|
checkConstraints = true
|
|
|
|
}
|
2021-01-08 16:19:25 +08:00
|
|
|
}
|
|
|
|
|
2019-08-08 17:55:56 +08:00
|
|
|
tasks.wrapper {
|
2021-06-10 16:01:27 +08:00
|
|
|
gradleVersion = "7.0.2"
|
2019-08-08 17:55:56 +08:00
|
|
|
distributionType = Wrapper.DistributionType.ALL
|
2019-11-15 15:44:26 +08:00
|
|
|
}
|