diff --git a/build.gradle.kts b/build.gradle.kts deleted file mode 100644 index 79534cdfc..000000000 --- a/build.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id("org.ajoberstar.grgit") -} diff --git a/gradle.properties b/gradle.properties index 666d232de..484976e45 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 \ No newline at end of file +org.gradle.daemon.idletimeout=10000 diff --git a/gui/vite.config.ts b/gui/vite.config.ts index a09fed7b6..b2f86c21e 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -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] diff --git a/server/android/build.gradle.kts b/server/android/build.gradle.kts index 6eba1c723..03e8a2195 100644 --- a/server/android/build.gradle.kts +++ b/server/android/build.gradle.kts @@ -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. diff --git a/server/desktop/build.gradle.kts b/server/desktop/build.gradle.kts index 1950bdbcc..d72fd8d3e 100644 --- a/server/desktop/build.gradle.kts +++ b/server/desktop/build.gradle.kts @@ -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 { diff --git a/settings.gradle.kts b/settings.gradle.kts index e2691d0b8..2e322d226 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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 } }