From e71d0f58d3e85fdbdb62e776417463ccaa4ec6ff Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Mon, 9 Feb 2026 13:44:03 -0600 Subject: [PATCH 1/2] Remove unneeded Gradle plugin It is simpler to just call the same underlying git command called by the plugin for this use case. --- build.gradle.kts | 13 +++++++++---- gradle/libs.versions.toml | 1 - 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c9e7d23b..ef0ad989 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,6 @@ import net.ltgt.gradle.errorprone.errorprone plugins { `java-library` alias(libs.plugins.errorprone) - alias(libs.plugins.git) alias(libs.plugins.maven) alias(libs.plugins.osdetector) } @@ -21,10 +20,16 @@ java { // If not specified, we attempt to calculate a snapshot version based on the last tagged release. // So if the local build's last tag was v0.1.9, this will set snapshotVersion to 0.1.10-SNAPSHOT. // If this fails for any reason, we'll fall back to using 0.0.0-SNAPSHOT version. -val versionDetails: groovy.lang.Closure by extra -val details = versionDetails() var snapshotVersion = "0.0.0-SNAPSHOT" -val matchResult = """^v(\d+)\.(\d+)\.(\d+)$""".toRegex().matchEntire(details.lastTag) +val lastTag = try { + providers.exec { + commandLine("git", "describe", "--tags", "--abbrev=0") + isIgnoreExitValue = true + }.standardOutput.asText.get().trim() +} catch (e: Exception) { + "" +} +val matchResult = """^v(\d+)\.(\d+)\.(\d+)$""".toRegex().matchEntire(lastTag) if (matchResult != null) { val (major, minor, patch) = matchResult.destructured snapshotVersion = "$major.$minor.${patch.toInt() + 1}-SNAPSHOT" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ab325bc3..25303818 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,6 +23,5 @@ spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = [plugins] errorprone = { id = "net.ltgt.errorprone", version = "4.4.0" } -git = { id = "com.palantir.git-version", version = "4.2.0" } maven = { id = "com.vanniktech.maven.publish.base", version.ref = "maven-publish" } osdetector = { id = "com.google.osdetector", version = "1.7.3" } From 5b50a553da3176ebff84ef660531c98ce3683f5b Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Mon, 9 Feb 2026 13:47:46 -0600 Subject: [PATCH 2/2] Keep spotless happy --- build.gradle.kts | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ef0ad989..b4d1ba59 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,14 +21,18 @@ java { // So if the local build's last tag was v0.1.9, this will set snapshotVersion to 0.1.10-SNAPSHOT. // If this fails for any reason, we'll fall back to using 0.0.0-SNAPSHOT version. var snapshotVersion = "0.0.0-SNAPSHOT" -val lastTag = try { - providers.exec { - commandLine("git", "describe", "--tags", "--abbrev=0") - isIgnoreExitValue = true - }.standardOutput.asText.get().trim() -} catch (e: Exception) { - "" -} +val lastTag = + try { + providers + .exec { + commandLine("git", "describe", "--tags", "--abbrev=0") + isIgnoreExitValue = true + }.standardOutput.asText + .get() + .trim() + } catch (e: Exception) { + "" + } val matchResult = """^v(\d+)\.(\d+)\.(\d+)$""".toRegex().matchEntire(lastTag) if (matchResult != null) { val (major, minor, patch) = matchResult.destructured