diff options
-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 |