From 7f5520499876f71f5f191380f92e0dd69abea8e2 Mon Sep 17 00:00:00 2001 From: mcc Date: Fri, 10 Feb 2023 15:22:32 -0500 Subject: [PATCH] Fix non-git build, broken by gradle modernization (PR#3171) --- app/build.gradle | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f05496dc7..85c867cc6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,9 +5,19 @@ plugins { alias(libs.plugins.kotlin.parcelize) } -final def gitSha = providers.exec { - commandLine('git', 'rev-parse', '--short=7', 'HEAD') -}.standardOutput.asText.get().trim() +// For constructing gitSha +def getGitSha = { + def stdout = new ByteArrayOutputStream() + try { + providers.exec { + commandLine 'git', 'rev-parse', '--short=7', 'HEAD' + }.standardOutput.asText.get().trim() + } catch (Exception e) { + "unknown" + } +} + +final def gitSha = getGitSha() // The app name final def APP_NAME = "Tusky"