From 4159826f266d7c6b69738d0668c43b33b68b51c8 Mon Sep 17 00:00:00 2001 From: mcclure Date: Wed, 11 May 2022 11:16:51 -0400 Subject: [PATCH] Allow build on systems without git (#2514) Set git revision to "unknown" if git not available. --- app/build.gradle | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c152805b4..2a34c80ae 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,9 +7,13 @@ apply from: "../instance-build.gradle" def getGitSha = { def stdout = new ByteArrayOutputStream() - exec { - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = stdout + try { + exec { + commandLine 'git', 'rev-parse', '--short', 'HEAD' + standardOutput = stdout + } + } catch (Exception e) { + return "unknown" } return stdout.toString().trim() }