Created
December 27, 2015 10:21
-
-
Save lwis/9c4eb28ca8872c38c11a to your computer and use it in GitHub Desktop.
Git tag Gradle build
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 getGitCommit = { -> | |
| def stdout = new ByteArrayOutputStream() | |
| exec { | |
| commandLine 'git', 'rev-parse', '--short', 'HEAD' | |
| standardOutput = stdout | |
| } | |
| return stdout.toString().trim() | |
| } | |
| android { | |
| defaultConfig { | |
| versionName "1.2.3-" + getGitCommit() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment