Created
October 4, 2014 08:14
-
-
Save r0adkll/8c5c06414d525034270b to your computer and use it in GitHub Desktop.
Gradle Auto Versioning Logic
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
//auto versioning logic | |
def versionPropertiesFile = file('version.properties') | |
if (versionPropertiesFile.canRead()) { | |
def Properties properties = new Properties() | |
properties.load(new FileInputStream(versionPropertiesFile)) | |
def build = properties['BUILD'].toInteger() + 1 | |
properties['BUILD'] = build.toString() | |
properties.store(versionPropertiesFile.newWriter(), null) | |
defaultConfig { | |
applicationId "com.example.app" | |
minSdkVersion 18 | |
targetSdkVersion 21 | |
versionCode 1 | |
versionName "0.1.${build}" | |
} | |
} |
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
MAJOR=0 | |
MINOR=1 | |
BUILD=422 | |
PATCH=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment