Update BuildGeneratorEditorWindow.cs

This commit is contained in:
Syntriax 2025-01-14 18:55:49 +03:00
parent c517a3bd8c
commit f84bc06ff3

View File

@ -126,7 +126,7 @@ public class BuildGeneratorEditorWindow : EditorWindow
public const int DEFAULT_MAJOR = 0; public const int DEFAULT_MAJOR = 0;
public const int DEFAULT_MINOR = 0; public const int DEFAULT_MINOR = 0;
public const int DEFAULT_PATCH = 0; public const int DEFAULT_PATCH = 0;
public const int DEFAULT_RELEASE_CANDIDATE = 1; public const int DEFAULT_RELEASE_CANDIDATE = 0;
public const int RELEASE_RC_VALUE = 99; public const int RELEASE_RC_VALUE = 99;
private readonly int _major; private readonly int _major;
@ -174,10 +174,13 @@ public class BuildGeneratorEditorWindow : EditorWindow
_minor = _releaseCandidate = 1; _minor = _releaseCandidate = 1;
} }
public readonly VersionDefinition IncreaseMajor() => new(Major + 1, DEFAULT_MINOR, DEFAULT_PATCH, 0); public readonly VersionDefinition IncreaseMajor() => new(Major + 1, DEFAULT_MINOR, DEFAULT_PATCH, DEFAULT_RELEASE_CANDIDATE);
public readonly VersionDefinition IncreaseMinor() => new(Major, Minor + 1, DEFAULT_PATCH, 0); public readonly VersionDefinition IncreaseMinor() => new(Major, Minor + 1, DEFAULT_PATCH, DEFAULT_RELEASE_CANDIDATE);
public readonly VersionDefinition IncreasePatch() => new(Major, Minor, Patch + 1, 0); public readonly VersionDefinition IncreasePatch() => new(Major, Minor, Patch + 1, DEFAULT_RELEASE_CANDIDATE);
public readonly VersionDefinition IncreaseReleaseCandidate() => new(Major, Minor, Patch, ReleaseCandidate + 1); public readonly VersionDefinition IncreaseReleaseCandidate()
=> ReleaseCandidate == RELEASE_RC_VALUE
? new(Major, Minor, Patch + 1, DEFAULT_RELEASE_CANDIDATE)
: new(Major, Minor, Patch, ReleaseCandidate + 1);
public readonly VersionDefinition ToReleaseVersion() => new(Major, Minor, Patch, RELEASE_RC_VALUE); public readonly VersionDefinition ToReleaseVersion() => new(Major, Minor, Patch, RELEASE_RC_VALUE);
public readonly int BuildNumber => int.Parse($"{Major.ToString(BUILD_NUMBER_FORMAT)}{Minor.ToString(BUILD_NUMBER_FORMAT)}{Patch.ToString(BUILD_NUMBER_FORMAT)}{ReleaseCandidate.ToString(BUILD_NUMBER_FORMAT)}"); public readonly int BuildNumber => int.Parse($"{Major.ToString(BUILD_NUMBER_FORMAT)}{Minor.ToString(BUILD_NUMBER_FORMAT)}{Patch.ToString(BUILD_NUMBER_FORMAT)}{ReleaseCandidate.ToString(BUILD_NUMBER_FORMAT)}");
@ -186,7 +189,7 @@ public class BuildGeneratorEditorWindow : EditorWindow
{ {
if (IsRelease) if (IsRelease)
return $"{Major}.{Minor}.{Patch}"; return $"{Major}.{Minor}.{Patch}";
return $"{Major}.{Minor}.{Patch}-rc{ReleaseCandidate}"; return $"{Major}.{Minor}.{Patch}-rc{ReleaseCandidate + 1}";
} }
public static bool operator >(VersionDefinition left, VersionDefinition right) => left.BuildNumber > right.BuildNumber; public static bool operator >(VersionDefinition left, VersionDefinition right) => left.BuildNumber > right.BuildNumber;