Last active
January 17, 2024 08:17
-
-
Save paramsen/4a92c9230d799caeb3b90897da27a80c to your computer and use it in GitHub Desktop.
Revisions
-
paramsen revised this gist
Feb 22, 2018 . 1 changed file with 1 addition and 1 deletion.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 @@ -1,4 +1,4 @@ // Generate a minor version code from git commit count (for prod builds) static def generateVersionCode() { def result = "git rev-list HEAD --count".execute().text.trim() //unix -
paramsen revised this gist
Feb 22, 2018 . 1 changed file with 1 addition and 1 deletion.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 @@ -12,6 +12,6 @@ def majorVersion = 1 android { defaultConfig { versionCode generateVersionCode() versionName "${majorVersion}.${generateVersionCode()}" } } -
paramsen revised this gist
Feb 21, 2018 . 1 changed file with 3 additions and 3 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 @@ -1,6 +1,6 @@ // Generate a minor version code from git commit count (ideally for prod builds in small scale projects) static def generateVersionCode() { def result = "git rev-list HEAD --count".execute().text.trim() //unix if(result.empty) result = "PowerShell -Command git rev-list HEAD --count".execute().text.trim() //windows if(result.empty) throw new RuntimeException("Could not generate versioncode on this platform? Cmd output: ${result.text}") @@ -11,7 +11,7 @@ def majorVersion = 1 android { defaultConfig { versionCode generateVersionCode() versionName "${majorVersion}.${getVersionCode()}" } } -
paramsen revised this gist
Feb 21, 2018 . 1 changed file with 2 additions and 2 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 @@ -1,8 +1,8 @@ // Generate a minor version code from git commit count static def getVersionCode() { def result = "git rev-list HEAD --count".execute().text.trim() //unix if(result.empty) result = "PowerShell -Command git rev-list HEAD --count".execute().text.trim() //windows if(result.empty) throw new RuntimeException("Could not generate versioncode on this platform? Cmd output: ${result.text}") return result.toInteger() } -
paramsen created this gist
Feb 21, 2018 .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,17 @@ // Generate a minor version code from git commit count static def getVersionCode() { def result = "git rev-list HEAD | wc -l".execute().text.trim() //unix if(result.empty) result = "PowerShell -Command git rev-list HEAD | wc -l".execute().text.trim() //windows if(result.empty) throw new RuntimeException("Could not generate versioncode on this platform? Cmd output: ${result.text}") return result.toInteger() } def majorVersion = 1 android { defaultConfig { versionCode getVersionCode() versionName "${majorVersion}.${getVersionCode()}" } }