aboutsummaryrefslogtreecommitdiff
path: root/java/android/OlmLibSdk/olm-sdk/build.gradle
diff options
context:
space:
mode:
Diffstat (limited to 'java/android/OlmLibSdk/olm-sdk/build.gradle')
-rw-r--r--java/android/OlmLibSdk/olm-sdk/build.gradle25
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.+'