From dd836f764623fc27cbd6c5cf42fe800b28f2d075 Mon Sep 17 00:00:00 2001 From: Andy Klimczak Date: Wed, 4 Jan 2017 03:55:11 -0500 Subject: [PATCH] Version name (#275) Add HEAD commit hash to debug version name suffix --- Clover/app/build.gradle | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Clover/app/build.gradle b/Clover/app/build.gradle index 48d7e68d..29f3ca56 100644 --- a/Clover/app/build.gradle +++ b/Clover/app/build.gradle @@ -1,5 +1,17 @@ apply plugin: 'com.android.application' +/** + * Gets the version name from the latest Git tag + */ +def getCommitHash = { -> + def stdout = new ByteArrayOutputStream() + exec { + commandLine 'git', 'rev-parse', '--short', 'HEAD' + standardOutput = stdout + } + return "-" + stdout.toString().trim() +} + android { compileSdkVersion 24 // update the travis config when changing this @@ -64,7 +76,7 @@ android { } debug { - versionNameSuffix " Debug" + versionNameSuffix getCommitHash() // minifyEnabled true // proguardFiles 'proguard.cfg' }