Get rid of grgit (#1878)

This commit is contained in:
Sapphire authored and GitHub committed 2026-06-22 14:07:05 +02:00
1 parent fc6304d7ee
commit cdde0b762f
6 files changed
+20 -18

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
+1 -1
View File
@@ -6,7 +6,7 @@ import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
import jotaiReactRefresh from 'jotai/babel/plugin-react-refresh';
const commitHash = execSync('git rev-parse --verify --short HEAD').toString().trim();
const commitHash = execSync('git rev-parse --verify --short=8 HEAD').toString().trim();
const versionTag = execSync('git --no-pager tag --sort -taggerdate --points-at HEAD')
.toString()
.split('\n')[0]
+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", "--abbrev=8", "--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
}
}