From c05f50998f5f9956a9734eceda71be9517c62381 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Sun, 23 Jul 2017 23:49:12 -0400 Subject: [PATCH] Add branch and commit hash to version name --- build.gradle | 1 + gradle.properties | 3 +++ uhabits-android/build.gradle | 12 +++++++++++- uhabits-android/src/main/AndroidManifest.xml | 4 +--- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index d455f59d0..f91bbd00e 100644 --- a/build.gradle +++ b/build.gradle @@ -11,6 +11,7 @@ buildscript { classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' classpath 'org.jacoco:org.jacoco.core:+' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$KOTLIN_VERSION" + classpath 'org.ajoberstar:grgit:1.5.0' } } diff --git a/gradle.properties b/gradle.properties index 7c2f57865..71ae360f9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,6 @@ +VERSION_CODE = 33 +VERSION_NAME = 1.7.6 + MIN_SDK_VERSION = 19 TARGET_SDK_VERSION = 25 COMPILE_SDK_VERSION = 25 diff --git a/uhabits-android/build.gradle b/uhabits-android/build.gradle index aebc5dd59..c6641792a 100644 --- a/uhabits-android/build.gradle +++ b/uhabits-android/build.gradle @@ -3,15 +3,25 @@ apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-kapt' apply plugin: 'jacoco' +import org.ajoberstar.grgit.Grgit + +ext { + git = Grgit.open(currentDir: projectDir) + GIT_COMMIT = git.head().id.substring(0, 8) + GIT_BRANCH = git.branch.current.name +} android { compileSdkVersion COMPILE_SDK_VERSION as Integer buildToolsVersion BUILD_TOOLS_VERSION defaultConfig { - applicationId "org.isoron.uhabits" + versionCode VERSION_CODE as Integer + versionName "$VERSION_NAME ($GIT_BRANCH $GIT_COMMIT)" minSdkVersion MIN_SDK_VERSION as Integer targetSdkVersion TARGET_SDK_VERSION as Integer + + applicationId "org.isoron.uhabits" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" javaCompileOptions { diff --git a/uhabits-android/src/main/AndroidManifest.xml b/uhabits-android/src/main/AndroidManifest.xml index 4918040e6..9cd1a37a6 100644 --- a/uhabits-android/src/main/AndroidManifest.xml +++ b/uhabits-android/src/main/AndroidManifest.xml @@ -19,9 +19,7 @@ --> + xmlns:android="http://schemas.android.com/apk/res/android">