Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save engincancan/6495e518df22c324a222609485e229eb to your computer and use it in GitHub Desktop.
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.
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