From 3a21023cdaf23f51ad27e0ec769adc47c8d3e44d Mon Sep 17 00:00:00 2001 From: Roman / Nea Date: Thu, 27 Jan 2022 11:21:50 +0100 Subject: Build Number (#70) Co-authored-by: IRONM00N <64110067+IRONM00N@users.noreply.github.com> --- build.gradle.kts | 19 +++++++++++++++++-- .../notenoughupdates/commands/StatsCommand.java | 2 +- 2 files changed, 18 insertions(+), 3 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: diff --git a/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java index 525e8aea..f069a0e0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/commands/StatsCommand.java @@ -120,7 +120,7 @@ public class StatsCommand extends ClientCommandBase { builder.category("Neu Settings"); builder.append("API Key", NotEnoughUpdates.INSTANCE.config.apiKey.apiKey.isEmpty() ? "FALSE" : "TRUE"); builder.append("On Skyblock", NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() ? "TRUE" : "FALSE"); - builder.append("Mod Version", Loader.instance().getIndexedModList().get(NotEnoughUpdates.MODID).getSource().getName()); + builder.append("Mod Version", Loader.instance().getIndexedModList().get(NotEnoughUpdates.MODID).getDisplayVersion()); builder.append("SB Profile", SBInfo.getInstance().currentProfile); builder.append("Has Advanced Tab", SBInfo.getInstance().hasNewTab ? "TRUE" : "FALSE"); builder.category("Repo Stats"); -- cgit