Created
May 20, 2015 16:30
-
-
Save jpotts18/86fd87642dff095200dd to your computer and use it in GitHub Desktop.
Gradle Build Script Sync with Git Android
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
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() | |
def commitCount = Integer.parseInt('git rev-list master --count'.execute([], project.rootDir).text.trim()) | |
def gitCurrentTag = 'git describe --tags --abbrev=0'.execute([], project.rootDir).text.trim() | |
android { | |
compileSdkVersion 22 | |
buildToolsVersion "22.0.1" | |
defaultConfig { | |
applicationId "com.some.app" | |
minSdkVersion 16 | |
targetSdkVersion 22 | |
versionCode commitCount | |
versionName gitCurrentTag | |
buildConfigField "String", "GIT_SHA", "\"${gitSha}\"" | |
} | |
buildTypes { | |
release { | |
minifyEnabled false | |
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment