aboutsummaryrefslogtreecommitdiff
path: root/build.gradle.kts
diff options
context:
space:
mode:
authorRoman / Nea <roman.graef@gmail.com>2022-01-27 11:21:50 +0100
committerGitHub <noreply@github.com>2022-01-27 21:21:50 +1100
commit3a21023cdaf23f51ad27e0ec769adc47c8d3e44d (patch)
tree047b3889c58846592bf87538adf8a6960afd59c8 /build.gradle.kts
parent6675186d9dd16898ab259a7be97ee7f089ea20be (diff)
downloadNotEnoughUpdates-3a21023cdaf23f51ad27e0ec769adc47c8d3e44d.tar.gz
NotEnoughUpdates-3a21023cdaf23f51ad27e0ec769adc47c8d3e44d.tar.bz2
NotEnoughUpdates-3a21023cdaf23f51ad27e0ec769adc47c8d3e44d.zip
Build Number (#70)
Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com>
Diffstat (limited to 'build.gradle.kts')
-rw-r--r--build.gradle.kts19
1 files changed, 17 insertions, 2 deletions
diff --git a/build.gradle.kts b/build.gradle.kts
index 26a89ab5..e824a9a0 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -1,5 +1,5 @@
+import java.io.ByteArrayOutputStream
import net.minecraftforge.gradle.user.ReobfMappingType
-
plugins {
java
id("net.minecraftforge.gradle.forge") version "6f5327738df"
@@ -8,7 +8,22 @@ plugins {
}
group = "io.github.moulberry"
-version = "2.1"
+val baseVersion = "2.1"
+
+
+var buildVersion = properties["BUILD_VERSION"]
+if (buildVersion == null) {
+ val stdout = ByteArrayOutputStream()
+ val execResult = exec {
+ commandLine("git", "describe", "--always", "--first-parent", "--abbrev=7")
+ standardOutput = stdout
+ }
+ if (execResult.exitValue == 0)
+ buildVersion = String(stdout.toByteArray()).trim()
+}
+
+version = baseVersion + (buildVersion?.let { "+$it" } ?: "")
+
// Toolchains: