Created
February 9, 2017 17:46
-
-
Save pratul/c09c1e6521a9149a3b4a71fd330ae59a 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