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}")