Created
May 20, 2015 16:29
-
-
Save mtrung/63f904f96d41a9363bd4 to your computer and use it in GitHub Desktop.
getVersionCode
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 getVersionCode = { -> | |
try { | |
def code = new ByteArrayOutputStream() | |
exec { | |
commandLine "git", "rev-list", "HEAD", "--count" | |
standardOutput = code | |
} | |
return code.toString().toInteger() | |
} | |
catch (ignored) { | |
return -1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment