修复无法解析类似 "26.1 Snapshot 1" 的版本号的问题 (#5002)
This commit is contained in:
@@ -337,6 +337,10 @@ public abstract sealed class GameVersionNumber implements Comparable<GameVersion
|
|||||||
} else if (suffix.startsWith("-snapshot-")) {
|
} else if (suffix.startsWith("-snapshot-")) {
|
||||||
releaseType = ReleaseType.SNAPSHOT;
|
releaseType = ReleaseType.SNAPSHOT;
|
||||||
eaVersion = VersionNumber.asVersion(suffix.substring("-snapshot-".length()));
|
eaVersion = VersionNumber.asVersion(suffix.substring("-snapshot-".length()));
|
||||||
|
} else if (suffix.startsWith(" Snapshot ")) {
|
||||||
|
needNormalize = true;
|
||||||
|
releaseType = ReleaseType.SNAPSHOT;
|
||||||
|
eaVersion = VersionNumber.asVersion(suffix.substring(" Snapshot ".length()));
|
||||||
} else if (suffix.startsWith("-pre")) {
|
} else if (suffix.startsWith("-pre")) {
|
||||||
releaseType = ReleaseType.PRE_RELEASE;
|
releaseType = ReleaseType.PRE_RELEASE;
|
||||||
eaVersion = VersionNumber.asVersion(suffix.substring("-pre".length()));
|
eaVersion = VersionNumber.asVersion(suffix.substring("-pre".length()));
|
||||||
|
|||||||
@@ -432,6 +432,7 @@ public final class GameVersionNumberTest {
|
|||||||
assertNormalized(version, version);
|
assertNormalized(version, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertNormalized("26.1-snapshot-1", "26.1 Snapshot 1");
|
||||||
assertNormalized("1.21.11-pre3", "1.21.11 Pre-Release 3");
|
assertNormalized("1.21.11-pre3", "1.21.11 Pre-Release 3");
|
||||||
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11 Pre-Release 3 Unobfuscated");
|
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11 Pre-Release 3 Unobfuscated");
|
||||||
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11-pre3 Unobfuscated");
|
assertNormalized("1.21.11-pre3_unobfuscated", "1.21.11-pre3 Unobfuscated");
|
||||||
|
|||||||
Reference in New Issue
Block a user