From 67347048b5050e6c53823f1f986909b0068b4b1f Mon Sep 17 00:00:00 2001 From: mcrcortex <18544518+MCRcortex@users.noreply.github.com> Date: Sun, 5 Jan 2025 08:31:34 +1000 Subject: [PATCH] Who knows if this works --- build.gradle | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 50a7f3c0..098e1de5 100644 --- a/build.gradle +++ b/build.gradle @@ -24,17 +24,22 @@ repositories { def gitCommitHash = { -> - def stdout = new ByteArrayOutputStream() - ExecResult result = exec ()->{ - commandLine 'git', 'rev-parse', '--short', 'HEAD' - standardOutput = stdout - ignoreExitValue = true - } + try { + def stdout = new ByteArrayOutputStream() + ExecResult result = exec () -> { + commandLine 'git', 'rev-parse', '--short', 'HEAD' + standardOutput = stdout + ignoreExitValue = true + } - if (result.getExitValue() != 0) { + if (result.getExitValue() != 0) { + return ""; + } else { + return stdout.toString().trim(); + } + } catch (Exception e) { + e.printStackTrace() return ""; - } else { - return stdout.toString().trim(); } }