diff options
author | Linnea Gräf <nea@nea.moe> | 2024-12-13 10:39:29 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-12-13 10:49:11 +0100 |
commit | 02b6e75378e057b05e7405001ea05603f23430f5 (patch) | |
tree | 570d3200411cd381c8443f0e40a8ec198e7afe71 | |
parent | e9d26be68e0a094e1edd6f1bf6a9b3e28fc30007 (diff) | |
download | LocalTransactionLedger-02b6e75378e057b05e7405001ea05603f23430f5.tar.gz LocalTransactionLedger-02b6e75378e057b05e7405001ea05603f23430f5.tar.bz2 LocalTransactionLedger-02b6e75378e057b05e7405001ea05603f23430f5.zip |
feat: Add git release to version number
-rw-r--r-- | build.gradle.kts | 14 | ||||
-rw-r--r-- | gradle.properties | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 54f4457..def2fdd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ import org.apache.commons.lang3.SystemUtils +import java.io.ByteArrayOutputStream plugins { idea @@ -9,10 +10,21 @@ plugins { kotlin("jvm") version "2.0.20" } +fun cmd(vararg args: String): String { + val baos = ByteArrayOutputStream() + exec { + standardOutput = baos + commandLine(*args) + } + return baos.toByteArray().decodeToString() +} + + val baseGroup: String by project val mcVersion: String by project -val version: String by project +val version: String = project.property("mod_version").toString() + "-" + cmd("git", "rev-parse", "--short", "HEAD") val mixinGroup = "$baseGroup.mixin" +project.version = version val modid: String by project // Toolchains: diff --git a/gradle.properties b/gradle.properties index b414fac..38adc2e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g baseGroup = moe.nea.ledger mcVersion = 1.8.9 modid = moneyledger -version = 1.0.0 +mod_version = 2.0.0 |