chore: Lazily change build delimiter

Dieser Commit ist enthalten in:
NotMyFault 2021-12-21 16:27:46 +01:00
Ursprung 78aff4c81f
Commit 7453f12e66
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 158F5701A6AAD00C
2 geänderte Dateien mit 3 neuen und 4 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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