Add git hash and version name
[rtmpclient.git] / app / build.gradle
index 618570c..cbded9d 100644 (file)
@@ -7,8 +7,10 @@ android {
         minSdkVersion 17
         targetSdkVersion 17
         versionCode 1
-        versionName "1.0"
+        versionName "v0.3.2"
         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+        buildConfigField "String", "GIT_REVISION", "\"${getGitVersion()}\""
+
 
         sourceSets.main {
             jni.srcDirs = []
@@ -24,6 +26,10 @@ android {
     }
 }
 
+def getGitVersion() {
+    return 'git rev-parse --short HEAD'.execute().text.trim()
+}
+
 dependencies {
     implementation fileTree(include: ['*.jar'], dir: 'libs')
     implementation 'com.android.support:appcompat-v7:27.1.1'