Forked from rob-murray/gradle_andr_version_code.groovy
Created
December 9, 2013 07:12
-
-
Save beshkenadze/7868467 to your computer and use it in GitHub Desktop.
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
| // add method to get the versionCode from cli param | |
| // eg. `gradle tasks -PversionCode=999` | |
| /** | |
| * Get the version code from command line param | |
| * | |
| * @return int If the param -PversionCode is present then return int value or -1 | |
| */ | |
| def getVersionCode = { -> | |
| def code = project.hasProperty('versionCode') ? versionCode.toInteger() : -1 | |
| println "VersionCode is set to $code" | |
| return code | |
| } | |
| // add to defaultConfig | |
| android { | |
| defaultConfig { | |
| versionCode getVersionCode() | |
| //... | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment