git not required to build

This commit is contained in:
Jesse Boyd 2017-08-13 00:23:55 +10:00
parent 8948645832
commit e9cbd7a51e
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -24,6 +24,7 @@ def buildNumber = ""
def semver = ""
def date = ""
ext {
try {
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
date = git.head().date.format("yy.MM.dd")
revision = "-${git.head().abbreviatedId}"
@ -43,7 +44,9 @@ ext {
case "change":
case "changed":
case "changes":
if (major == 0) {minorCount = 1; patchCount = 0;}
if (major == 0) {
minorCount = 1; patchCount = 0;
}
break;
case "refactor":
case "remove":
@ -60,6 +63,9 @@ ext {
}
buildNumber = "-${index}"
semver = "-${major}.${minor}.${patch}"
} catch (Throwable ignore) {
revision = "unknown";
}
}
version = date + revision + buildNumber + semver