chore: Lazily change build delimiter

This commit is contained in:
NotMyFault 2021-12-21 16:27:46 +01:00
parent 78aff4c81f
commit 7453f12e66
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
2 changed files with 3 additions and 4 deletions

View File

@ -34,7 +34,7 @@ ext {
date = git.head().dateTime.format(DateTimeFormatter.ofPattern("yy.MM.dd"))
revision = "-${git.head().abbreviatedId}"
buildNumber = if (project.hasProperty("buildnumber")) {
snapshot + "+" + project.properties["buildnumber"] as String
snapshot + "-" + project.properties["buildnumber"] as String
} else {
project.properties["snapshot"] as String
}

View File

@ -7,7 +7,6 @@ import java.util.Locale;
/**
* An internal FAWE class not meant for public use.
**/
//TODO 18 update to semver
public class FaweVersion {
public final int year;
@ -37,7 +36,7 @@ public class FaweVersion {
}
this.semver = ver;
this.snapshot = split.length > 1 && split[1].toLowerCase(Locale.ROOT).contains("snapshot");
this.build = version.contains("+") ? Integer.parseInt(version.substring(version.indexOf('+') + 1)) : 0;
this.build = version.contains("-") ? Integer.parseInt(version.substring(version.indexOf('-') + 10)) : 0;
this.hash = Integer.parseInt(commit.substring(commit.indexOf('=') + 1), 16);
String[] split2 = date.substring(date.indexOf('=') + 1).split("\\.");
this.year = Integer.parseInt(split2[0]);
@ -60,7 +59,7 @@ public class FaweVersion {
return "FastAsyncWorldEdit-NoVer-SNAPSHOT";
} else {
String snapshot = this.snapshot ? "-SNAPSHOT" : "";
String build = this.build > 0 ? "+" + this.build : "";
String build = this.build > 0 ? "-" + this.build : "";
return "FastAsyncWorldEdit-" + StringMan.join(semver, ".") + snapshot + build;
}
}