mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2024-12-29 12:37:53 +01:00
git not required to build
This commit is contained in:
parent
8948645832
commit
e9cbd7a51e
72
build.gradle
72
build.gradle
@ -24,42 +24,48 @@ def buildNumber = ""
|
||||
def semver = ""
|
||||
def date = ""
|
||||
ext {
|
||||
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
|
||||
date = git.head().date.format("yy.MM.dd")
|
||||
revision = "-${git.head().abbreviatedId}"
|
||||
parents = git.head().parentIds;
|
||||
index = -96; // Offset to match CI
|
||||
int major, minor, patch;
|
||||
major = minor = patch = 0;
|
||||
for (;parents != null && !parents.isEmpty();index++) {
|
||||
int majorCount, minorCount, patchCount;
|
||||
patchCount = minor == 0 && major == 0 ? 1 : 0;
|
||||
commit = git.getResolve().toCommit(parents.get(0));
|
||||
for (String line : commit.fullMessage.tokenize("\n")) {
|
||||
switch (line.replaceAll("- ", "").split(" ")[0].toLowerCase()) {
|
||||
case "minor":
|
||||
case "added":
|
||||
case "add":
|
||||
case "change":
|
||||
case "changed":
|
||||
case "changes":
|
||||
if (major == 0) {minorCount = 1; patchCount = 0;}
|
||||
break;
|
||||
case "refactor":
|
||||
case "remove":
|
||||
case "major":
|
||||
patchCount = minorCount = 0;
|
||||
majorCount = 1;
|
||||
break;
|
||||
try {
|
||||
git = org.ajoberstar.grgit.Grgit.open(file(".git"))
|
||||
date = git.head().date.format("yy.MM.dd")
|
||||
revision = "-${git.head().abbreviatedId}"
|
||||
parents = git.head().parentIds;
|
||||
index = -96; // Offset to match CI
|
||||
int major, minor, patch;
|
||||
major = minor = patch = 0;
|
||||
for (; parents != null && !parents.isEmpty(); index++) {
|
||||
int majorCount, minorCount, patchCount;
|
||||
patchCount = minor == 0 && major == 0 ? 1 : 0;
|
||||
commit = git.getResolve().toCommit(parents.get(0));
|
||||
for (String line : commit.fullMessage.tokenize("\n")) {
|
||||
switch (line.replaceAll("- ", "").split(" ")[0].toLowerCase()) {
|
||||
case "minor":
|
||||
case "added":
|
||||
case "add":
|
||||
case "change":
|
||||
case "changed":
|
||||
case "changes":
|
||||
if (major == 0) {
|
||||
minorCount = 1; patchCount = 0;
|
||||
}
|
||||
break;
|
||||
case "refactor":
|
||||
case "remove":
|
||||
case "major":
|
||||
patchCount = minorCount = 0;
|
||||
majorCount = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
major += majorCount;
|
||||
minor += minorCount;
|
||||
patch += patchCount;
|
||||
parents = commit.getParentIds()
|
||||
}
|
||||
major += majorCount;
|
||||
minor += minorCount;
|
||||
patch += patchCount;
|
||||
parents = commit.getParentIds()
|
||||
buildNumber = "-${index}"
|
||||
semver = "-${major}.${minor}.${patch}"
|
||||
} catch (Throwable ignore) {
|
||||
revision = "unknown";
|
||||
}
|
||||
buildNumber = "-${index}"
|
||||
semver = "-${major}.${minor}.${patch}"
|
||||
}
|
||||
|
||||
version = date + revision + buildNumber + semver
|
||||
|
Loading…
Reference in New Issue
Block a user