Forked from pratul/android-versionname-git-describe.gradle
Created
March 1, 2017 06:14
-
-
Save engincancan/6495e518df22c324a222609485e229eb to your computer and use it in GitHub Desktop.
A gradle method to generate the versionName for an Android app, using git describe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getVersionName = { -> | |
try { | |
def stdout = new ByteArrayOutputStream() | |
exec { | |
commandLine 'git', 'describe', '--dirty' | |
standardOutput = stdout | |
} | |
return stdout.toString().trim() | |
} | |
catch (ignored) { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment