Last active
August 29, 2015 14:19
Revisions
-
menny revised this gist
Apr 14, 2015 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ android { defaultConfig { versionCode versionbuilder.VersionBuilder.buildGitVersionNumber() versionName versionbuilder.VersionBuilder.buildGitVersionName() } -
menny created this gist
Apr 14, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ package versionbuilder class VersionBuilder { static final int GIT_COMMIT_COUNT_NORMALIZE = 230; static final int GIT_COMMIT_COUNT_MINOR_NORMALIZE = 0; static def buildGitVersionNumber() { return Integer.parseInt('git rev-list --count HEAD'.execute().text.trim()) - GIT_COMMIT_COUNT_NORMALIZE; } static def buildGitVersionName() { return String.format("%d.%d.%d-beta", 0, 1, buildGitVersionNumber() - GIT_COMMIT_COUNT_MINOR_NORMALIZE); } }