diff --git a/distributor-build-logic/build.gradle.kts b/distributor-build-logic/build.gradle.kts index 3ea60436..5805d0c5 100644 --- a/distributor-build-logic/build.gradle.kts +++ b/distributor-build-logic/build.gradle.kts @@ -14,6 +14,7 @@ dependencies { implementation(libs.bundles.indra) implementation(libs.errorprone.gradle) implementation(libs.mammoth) + implementation(libs.gradle.versions) // https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) diff --git a/distributor-build-logic/src/main/kotlin/distributor4.parent-conventions.gradle.kts b/distributor-build-logic/src/main/kotlin/distributor4.parent-conventions.gradle.kts index 251ffbad..47b3d320 100644 --- a/distributor-build-logic/src/main/kotlin/distributor4.parent-conventions.gradle.kts +++ b/distributor-build-logic/src/main/kotlin/distributor4.parent-conventions.gradle.kts @@ -3,6 +3,7 @@ import com.diffplug.gradle.spotless.SpotlessExtensionPredeclare plugins { id("com.diffplug.spotless") id("net.kyori.indra.git") + id("com.github.ben-manes.versions") } repositories { @@ -18,3 +19,18 @@ extensions.configure { kotlin { ktlint(libs.versions.ktlint.get()) } kotlinGradle { ktlint(libs.versions.ktlint.get()) } } + +// https://github.com/ben-manes/gradle-versions-plugin +fun isNonStable(version: String): Boolean { + val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } + val regex = "^[0-9,.v-]+(-r)?$".toRegex() + val isStable = stableKeyword || regex.matches(version) + return isStable.not() +} + +tasks.dependencyUpdates { + // https://github.com/ben-manes/gradle-versions-plugin + rejectVersionIf { + isNonStable(candidate.version) && !isNonStable(currentVersion) + } +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index c761fc4d..6e8dbac7 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,29 +8,29 @@ java = "17" mindustry = "v146" # logging -slf4j = "2.0.11" +slf4j = "2.0.12" # command cloud = "2.0.0-beta.3" # utilities -immutables = "2.9.2" +immutables = "2.10.1" geantyref = "1.3.15" configurate = "4.1.2" # testing -junit = "5.10.1" -assert4j = "3.25.1" +junit = "5.10.2" +assert4j = "3.25.3" # static analysis jspecify = "0.3.0" errorprone-gradle = "3.1.0" -errorprone-core = "2.24.1" -nullaway = "0.10.21" +errorprone-core = "2.25.0" +nullaway = "0.10.24" # linting -palantir = "2.39.0" -ktlint = "0.49.1" +palantir = "2.40.0" +ktlint = "0.51.0-FINAL" # gradle toxopid = "3.2.0" @@ -38,6 +38,7 @@ indra = "3.1.3" spotless = "6.24.0" shadow = "8.1.1" mammoth = "1.3.1" +gradle-versions = "0.51.0" [libraries] @@ -78,6 +79,7 @@ indra-licenser-spotless = { module = "net.kyori:indra-licenser-spotless", versio spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version.ref = "spotless" } shadow = { module = "com.github.johnrengelman:shadow", version.ref = "shadow" } mammoth = { module = "net.kyori:mammoth", version.ref = "mammoth" } +gradle-versions = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "gradle-versions" } [bundles] indra = [ "indra-common", "indra-licenser-spotless" ]