From a263f400e3a60b39e66fd01092b39bfc5aeebb13 Mon Sep 17 00:00:00 2001 From: Len <40720638+destro174@users.noreply.github.com> Date: Wed, 19 Oct 2022 18:01:38 +0200 Subject: [PATCH] Add git version --- build.gradle.kts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 9fd9dba..0a8bb22 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,5 @@ +import java.io.ByteArrayOutputStream + plugins { id("java") id("com.github.johnrengelman.shadow") version "7.1.0" @@ -46,3 +48,13 @@ publishing { dependencies { compileOnly("com.alttd:Galaxy-API:1.19.2-R0.1-SNAPSHOT") } + +fun gitCommit(): String { + val os = ByteArrayOutputStream() + project.exec { + isIgnoreExitValue = true + commandLine = "git rev-parse --short HEAD".split(" ") + standardOutput = os + } + return String(os.toByteArray()).trim() +}