Get rid of grgit

This commit is contained in:
Sapphire committed 2026-06-21 13:24:18 -05:00
1 parent 7c6151fbe5
commit 31af38e663
5 files changed
+19 -17

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
plugins {
id("org.ajoberstar.grgit")
}
+1 -4
View File
@@ -17,10 +17,7 @@ kotlinVersion=2.3.10
spotlessVersion=8.2.1
shadowJarVersion=9.3.1
buildconfigVersion=6.0.7
# We should probably stop using grgit, see:
# https://andrewoberstar.com/posts/2024-04-02-dont-commit-to-grgit/
grgitVersion=5.3.3
# Fix gradle leaving multiple java processes running that accumulate and use multiple GBs of RAM
# This mostly seems to affect it when running from console, and then sending a SIGINT (Ctrl + C)
org.gradle.daemon.idletimeout=10000
org.gradle.daemon.idletimeout=10000
+8 -3
View File
@@ -17,7 +17,6 @@ plugins {
id("com.github.gmazzo.buildconfig")
id("com.android.application") version "8.13.2"
id("org.ajoberstar.grgit")
}
kotlin {
@@ -124,8 +123,14 @@ dependencies {
// The android block is where you configure all your Android-specific build options.
extra.apply {
set("gitVersionCode", grgit.tag.list().size)
set("gitVersionName", grgit.describe(mapOf("tags" to true, "always" to true)))
val tagCount = providers.exec {
commandLine("git", "--no-pager", "tag", "-l")
}.standardOutput.asText.get().trim().split('\n').size
val description = providers.exec {
commandLine("git", "describe", "--tags", "--always")
}.standardOutput.asText.get().trim()
set("gitVersionCode", tagCount)
set("gitVersionName", description)
}
android {
// The app's namespace. Used primarily to access app resources.
+10 -5
View File
@@ -13,7 +13,6 @@ plugins {
application
id("com.gradleup.shadow")
id("com.github.gmazzo.buildconfig")
id("org.ajoberstar.grgit")
}
kotlin {
@@ -89,12 +88,18 @@ buildConfig {
useKotlinOutput { topLevelConstants = true }
packageName("dev.slimevr.desktop")
val gitCommitHash = providers.exec {
commandLine("git", "rev-parse", "--short=8", "HEAD")
}.standardOutput.asText.get().trim()
val gitVersionTag = providers.exec {
commandLine("git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at", "HEAD")
}.standardOutput.asText.get().split('\n').first()
buildConfigField("String", "GIT_COMMIT_HASH", "\"${grgit.head().abbreviatedId}\"")
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag.trim()}\"")
buildConfigField("boolean", "GIT_CLEAN", grgit.status().isClean.toString())
}.standardOutput.asText.get().trim()
val gitIsClean = providers.exec {
commandLine("git", "status", "--porcelain")
}.standardOutput.asText.get().trim().isEmpty()
buildConfigField("String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"")
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag}\"")
buildConfigField("boolean", "GIT_CLEAN", gitIsClean.toString())
}
tasks.run<JavaExec> {
-2
View File
@@ -20,7 +20,6 @@ pluginManagement {
val spotlessVersion: String by settings
val shadowJarVersion: String by settings
val buildconfigVersion: String by settings
val grgitVersion: String by settings
plugins {
kotlin("plugin.serialization") version kotlinVersion
kotlin("jvm") version kotlinVersion
@@ -28,7 +27,6 @@ pluginManagement {
id("com.diffplug.spotless") version spotlessVersion
id("com.gradleup.shadow") version shadowJarVersion
id("com.github.gmazzo.buildconfig") version buildconfigVersion
id("org.ajoberstar.grgit") version grgitVersion
}
}