Created
December 16, 2015 21:31
-
-
Save designatednerd/109c89922b0a89515b35 to your computer and use it in GitHub Desktop.
Using the number of commits in the HEAD to auto-increment your android version count.
This file contains 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
//Counts the number of commits on the HEAD of the repo. | |
def headCommitCount() { | |
def cmd = "git rev-list HEAD --count" | |
return cmd.execute().text.toInteger() | |
} | |
android { | |
defaultConfig { | |
versionCode headCommitCount() //Auto-increment the version based on how many commits have occurred. | |
versionName "x.x.x (" + versionCode + ")" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment