From 50b23630e587c820b3c69fd6b0067064ef5b264a Mon Sep 17 00:00:00 2001 From: Michael Zangl Date: Fri, 21 Jul 2017 15:52:40 +0200 Subject: [PATCH] Automatically get minebot version. --- Minebot/build.gradle | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Minebot/build.gradle b/Minebot/build.gradle index 5c6dfc11..ea2bb5d5 100644 --- a/Minebot/build.gradle +++ b/Minebot/build.gradle @@ -5,12 +5,22 @@ buildscript { } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath 'org.ajoberstar:grgit:1.1.0' } } apply plugin: 'net.minecraftforge.gradle.forge' compileJava.options.encoding = 'UTF-8' -version='1.12.1' + +// VERSION +def git = org.ajoberstar.grgit.Grgit.open(file('..')) +def git_head = git.head() +def git_tags = git.tag.list().findAll { + it.commit == git_head +} +version = git_tags.size() > 0 ? git_tags[0].getName() : git_head.abbreviatedId; +println "Compiling version ${version}" + group = "de.michaelzangl.minebot" archivesBaseName = project.projectDir.name