Fix build script not working when git repo isn't cloned (#3831)

This commit is contained in:
Josh Roy 2020-12-13 23:54:54 -05:00 committed by GitHub
parent d4ed77fdc6
commit f320705216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

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