Skip to content

Commit f320705

Browse files
authored
Fix build script not working when git repo isn't cloned (#3831)
1 parent d4ed77f commit f320705

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ allprojects {
2020
}
2121

2222
def commitsSinceLastTag() {
23+
if (grgit == null) {
24+
return 0
25+
}
2326
def tags = grgit.tag.list().stream().map({it.commit}).toList()
2427
def commit = grgit.head()
2528
def depth = 0
@@ -32,7 +35,7 @@ def commitsSinceLastTag() {
3235
}
3336

3437
ext {
35-
GIT_COMMIT = grgit.head().abbreviatedId
38+
GIT_COMMIT = grgit == null ? "unknown" : grgit.head().abbreviatedId
3639
GIT_DEPTH = commitsSinceLastTag()
3740

3841
fullVersion = "${version}-${GIT_COMMIT}".replace("-SNAPSHOT", "-dev+${GIT_DEPTH}")

0 commit comments

Comments
 (0)