Skip to content

Commit

Permalink
Automating versioning.
Browse files Browse the repository at this point in the history
Change-Id: I2c9126b83d23ec557b222f812f9bb73922603317
  • Loading branch information
nickbutcher committed Aug 14, 2015
1 parent bf9b18c commit b614791
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

apply plugin: 'com.android.application'

// query git for the the SHA, Tag and commit count. Use these to automate versioning.
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
def gitTag = 'git describe --tags'.execute([], project.rootDir).text.trim()
def gitCommitCount =
Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())

android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
Expand All @@ -24,8 +30,9 @@ android {
applicationId "com.android.example.plaid"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName '0.5'
versionCode gitCommitCount
versionName gitTag
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
}
buildTypes {
release {
Expand Down

0 comments on commit b614791

Please sign in to comment.