summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorTim Mutton <tim.mutton@outware.com.au>2017-04-06 19:53:25 +1000
committerTim Mutton <tim.mutton@outware.com.au>2017-05-04 17:13:31 +1000
commit1fe1e11e0e70daffd4fdb5e24e9784458b8d248c (patch)
treeb8f5e08a8c0eec53f8f020735b023c5a19ad6374 /Source/Android
parentc8d66fa2467655d89b89818e12bd2796be0c64af (diff)
Use try/catch with logging for version number
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/app/build.gradle17
1 files changed, 9 insertions, 8 deletions
diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle
index ea7165d4d5..3f2b90bc6d 100644
--- a/Source/Android/app/build.gradle
+++ b/Source/Android/app/build.gradle
@@ -1,5 +1,3 @@
-import org.apache.tools.ant.taskdefs.condition.Os
-
apply plugin: 'com.android.application'
android {
@@ -96,12 +94,15 @@ dependencies {
}
def getVersion() {
- String result
- if(Os.isFamily(Os.FAMILY_WINDOWS)) {
- result = 'cmd /c git describe --always --long'.execute([], project.rootDir).text
- } else {
- result = 'git describe --always --long'.execute([], project.rootDir).text
+ def versionNumber = '0.0'
+
+ try {
+ versionNumber = 'git describe --always --long'.execute([], project.rootDir).text
+ .trim()
+ .replaceAll(/(-0)?-[^-]+$/, "")
+ } catch (Exception e) {
+ logger.error('Cannot find git, defaulting to dummy version number')
}
- return result.trim().replaceAll(/(-0)?-[^-]+$/, "")
+ return versionNumber
}