From 687e063ad9863fe833e1d1a6585091cce4b7b1ea Mon Sep 17 00:00:00 2001 From: Len <40720638+destro174@users.noreply.github.com> Date: Mon, 25 Dec 2023 14:35:44 +0100 Subject: [PATCH] Add buildnumber --- build.gradle.kts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index a3ed92e..5e4fb03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import java.io.ByteArrayOutputStream plugins { id("java") @@ -6,7 +7,7 @@ plugins { } group = "com.alttd" -version = "2.1.6" +version = System.getenv("BUILD_NUMBER") ?: gitCommit() description = "Altitude AFK Detector plugin." apply() @@ -45,4 +46,14 @@ tasks { dependencies { implementation("com.alttd:Galaxy-API:1.20.4-R0.1-SNAPSHOT") compileOnly("de.keyle:mypet:3.11-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() } \ No newline at end of file