Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mladenrakonjac/d4e4c36c54437e6f01449f544beee5e8 to your computer and use it in GitHub Desktop.
Save mladenrakonjac/d4e4c36c54437e6f01449f544beee5e8 to your computer and use it in GitHub Desktop.
def getVersionCode = { ->
try {
def code = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-list', '--remotes'
standardOutput = code
}
return code.toString().split("\n").size()
}
catch (ignored) {
return -1;
}
}
def getVersionName = { ->
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine './version.sh'
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