diff options
author | ylecollen <ylecollen@amdocs.com> | 2017-01-09 16:39:54 +0100 |
---|---|---|
committer | ylecollen <ylecollen@amdocs.com> | 2017-01-09 16:39:54 +0100 |
commit | 29339bc00a52391d78d7f9b723880ce5577d8981 (patch) | |
tree | fe16209b2576ed9f1f6d1bafce49ab43507fe10b /java/android/OlmLibSdk/olm-sdk/build.gradle | |
parent | a14bf30c43d87e6316fd984a6be76de0c9a9ba7a (diff) |
Update getSdkOlmVersion to provide the git commit
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/build.gradle')
-rw-r--r-- | java/android/OlmLibSdk/olm-sdk/build.gradle | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/java/android/OlmLibSdk/olm-sdk/build.gradle b/java/android/OlmLibSdk/olm-sdk/build.gradle index 188acb6..9ce4d37 100644 --- a/java/android/OlmLibSdk/olm-sdk/build.gradle +++ b/java/android/OlmLibSdk/olm-sdk/build.gradle @@ -15,7 +15,17 @@ android { testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { + debug { + resValue "string", "git_olm_revision", "\"${gitRevision()}\"" + resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\"" + resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\"" + } + release { + resValue "string", "git_olm_revision", "\"${gitRevision()}\"" + resValue "string", "git_olm_revision_unix_date", "\"${gitRevisionUnixDate()}\"" + resValue "string", "git_olm_revision_date", "\"${gitRevisionDate()}\"" + minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } @@ -93,6 +103,21 @@ def getNdkBuildCmd() { return ndkBuildCmd } +def gitRevision() { + def cmd = "git rev-parse --short HEAD" + return cmd.execute().text.trim() +} + +def gitRevisionUnixDate() { + def cmd = "git show -s --format=%ct HEAD^{commit}" + return cmd.execute().text.trim() +} + +def gitRevisionDate() { + def cmd = "git show -s --format=%ci HEAD^{commit}" + return cmd.execute().text.trim() +} + dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:21.+' |