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 {
|
2023-06-27 17:02:28 +08:00
|
|
|
val kotlinVersion = "1.8.22"
|
2021-02-17 16:58:46 +08:00
|
|
|
kotlin("jvm") version kotlinVersion
|
|
|
|
kotlin("plugin.spring") version kotlinVersion
|
|
|
|
kotlin("kapt") version kotlinVersion
|
|
|
|
}
|
2023-06-26 11:00:26 +08:00
|
|
|
id("org.jlleitschuh.gradle.ktlint") version "11.4.2"
|
2023-05-23 17:31:26 +08:00
|
|
|
id("com.github.ben-manes.versions") version "0.46.0"
|
2021-01-08 16:19:25 +08:00
|
|
|
}
|
|
|
|
|
2021-04-27 09:53:47 +08:00
|
|
|
fun isNonStable(version: String): Boolean {
|
2023-06-26 11:01:45 +08:00
|
|
|
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
|
|
|
|
val unstableKeyword = listOf("ALPHA", "RC").any { version.uppercase().contains(it) }
|
2021-04-27 09:53:47 +08:00
|
|
|
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-06-10 16:34:14 +08:00
|
|
|
|
|
|
|
configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
|
2023-02-02 15:06:23 +08:00
|
|
|
version.set("0.48.2")
|
2021-06-10 16:34:14 +08:00
|
|
|
}
|
2021-01-08 16:19:25 +08:00
|
|
|
}
|
|
|
|
|
2019-08-08 17:55:56 +08:00
|
|
|
tasks.wrapper {
|
2023-05-23 16:51:29 +08:00
|
|
|
gradleVersion = "8.1.1"
|
2019-08-08 17:55:56 +08:00
|
|
|
distributionType = Wrapper.DistributionType.ALL
|
2019-11-15 15:44:26 +08:00
|
|
|
}
|