Skip to content

Commit

Permalink
feat(build): Added gradle versions plugin + dependency bumps
Browse files Browse the repository at this point in the history
  • Loading branch information
phinner committed Mar 7, 2024
1 parent e0c05f2 commit 34a7af3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
1 change: 1 addition & 0 deletions distributor-build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -18,3 +19,18 @@ extensions.configure<SpotlessExtensionPredeclare> {
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)
}
}
18 changes: 10 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,37 @@ 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"
indra = "3.1.3"
spotless = "6.24.0"
shadow = "8.1.1"
mammoth = "1.3.1"
gradle-versions = "0.51.0"

[libraries]

Expand Down Expand Up @@ -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" ]
Expand Down

0 comments on commit 34a7af3

Please sign in to comment.