From f3207052168a56eb668b66a5955632755ae61d94 Mon Sep 17 00:00:00 2001 From: Josh Roy <10731363+JRoy@users.noreply.github.com> Date: Sun, 13 Dec 2020 23:54:54 -0500 Subject: [PATCH] Fix build script not working when git repo isn't cloned (#3831) --- build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 7bcbfd4fc..2ced1ac05 100644 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,9 @@ allprojects { } def commitsSinceLastTag() { + if (grgit == null) { + return 0 + } def tags = grgit.tag.list().stream().map({it.commit}).toList() def commit = grgit.head() def depth = 0 @@ -32,7 +35,7 @@ def commitsSinceLastTag() { } ext { - GIT_COMMIT = grgit.head().abbreviatedId + GIT_COMMIT = grgit == null ? "unknown" : grgit.head().abbreviatedId GIT_DEPTH = commitsSinceLastTag() fullVersion = "${version}-${GIT_COMMIT}".replace("-SNAPSHOT", "-dev+${GIT_DEPTH}")