From 7f5520499876f71f5f191380f92e0dd69abea8e2 Mon Sep 17 00:00:00 2001 From: mcc Date: Fri, 10 Feb 2023 15:22:32 -0500 Subject: [PATCH 1/3] 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" From fe8ed9f331d863b948c9fac09731f93151b3aae7 Mon Sep 17 00:00:00 2001 From: mcc Date: Fri, 10 Feb 2023 15:30:12 -0500 Subject: [PATCH 2/3] Fix merge error --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 85c867cc6..2d97f7538 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,6 @@ plugins { // For constructing gitSha def getGitSha = { - def stdout = new ByteArrayOutputStream() try { providers.exec { commandLine 'git', 'rev-parse', '--short=7', 'HEAD' From b3db7b91af20e45a73e7b6b1754b848b02975adb Mon Sep 17 00:00:00 2001 From: mcc Date: Fri, 10 Feb 2023 15:33:53 -0500 Subject: [PATCH 3/3] Increase git hash from 7 back to 8 characters. Clearer comments --- app/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 2d97f7538..215cada2b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,14 +5,14 @@ plugins { alias(libs.plugins.kotlin.parcelize) } -// For constructing gitSha +// For constructing gitSha only def getGitSha = { try { providers.exec { - commandLine 'git', 'rev-parse', '--short=7', 'HEAD' + commandLine 'git', 'rev-parse', 'HEAD' }.standardOutput.asText.get().trim() } catch (Exception e) { - "unknown" + "unknown" // Try-catch is necessary for build to work on non-git distributions } }