diff --git a/build.gradle.kts b/build.gradle.kts index b24c5056..894e92da 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask + plugins { run { val kotlinVersion = "1.4.31" @@ -9,12 +11,30 @@ plugins { id("com.github.ben-manes.versions") version "0.38.0" } +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 +} + allprojects { repositories { mavenCentral() } apply(plugin = "org.jlleitschuh.gradle.ktlint") apply(plugin = "com.github.ben-manes.versions") + + tasks.named("dependencyUpdates").configure { + // disallow release candidates as upgradable versions from stable versions + rejectVersionIf { + isNonStable(candidate.version) && !isNonStable(currentVersion) + } + gradleReleaseChannel = "current" + checkConstraints = true + } + } tasks.wrapper { diff --git a/komga/build.gradle.kts b/komga/build.gradle.kts index ecf08610..6baeaf14 100644 --- a/komga/build.gradle.kts +++ b/komga/build.gradle.kts @@ -1,4 +1,3 @@ -import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import org.apache.tools.ant.taskdefs.condition.Os import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -257,20 +256,6 @@ openApi { forkProperties.set("-Dspring.profiles.active=claim") } -fun isNonStable(version: String): Boolean { - val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) } - val regex = "^[0-9,.v-]+(-r)?$".toRegex() - val isStable = stableKeyword || regex.matches(version) - return isStable.not() -} -tasks.named("dependencyUpdates", DependencyUpdatesTask::class.java).configure { - // disallow release candidates as upgradable versions from stable versions - rejectVersionIf { - isNonStable(candidate.version) && !isNonStable(currentVersion) - } - gradleReleaseChannel = "current" -} - configure { version.set("0.40.0") filter {