Update BuildGeneratorEditorWindow.cs
This commit is contained in:
parent
b52769443e
commit
c517a3bd8c
@ -36,13 +36,15 @@ public class BuildGeneratorEditorWindow : EditorWindow
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.LabelField($"Git Version: {editorVersion} ({editorVersion.BuildNumber})", new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter });
|
||||
if (GUILayout.Button($"Create Release")) CommitVersion(GitProcess.GetUpcomingReleaseVersion());
|
||||
if (GUILayout.Button($"Create Release Candidate")) CommitVersion(GitProcess.GetUpcomingReleaseCandidateVersion());
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.BeginVertical();
|
||||
EditorGUILayout.LabelField($"Editor Version: {editorVersion} ({editorVersion.BuildNumber})");
|
||||
EditorGUILayout.LabelField($"Git Version: {editorVersion} ({editorVersion.BuildNumber})");
|
||||
EditorGUILayout.LabelField($"Editor Version: {editorVersion} ({editorVersion.BuildNumber})", new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter });
|
||||
if (GUILayout.Button($"Create Release")) CommitVersion(editorVersion.ToReleaseVersion());
|
||||
if (GUILayout.Button($"Create Release Candidate")) CommitVersion(editorVersion.IncreaseReleaseCandidate());
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
@ -51,35 +53,35 @@ public class BuildGeneratorEditorWindow : EditorWindow
|
||||
if (GUILayout.Button($"Push All")) { GitProcess.Push(); GitProcess.PushTags(); }
|
||||
|
||||
EditorGUILayout.Space();
|
||||
EditorGUILayout.LabelField("Force New Version");
|
||||
EditorGUILayout.LabelField("Force New Version", new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter });
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
if (IncrementButton("Major", versionDefinition.IncreaseMajor()))
|
||||
CommitVersion(versionDefinition.IncreaseMajor());
|
||||
if (IncrementButton("Major", editorVersion.IncreaseMajor()))
|
||||
CommitVersion(editorVersion.IncreaseMajor());
|
||||
|
||||
if (IncrementButton("Minor", versionDefinition.IncreaseMinor()))
|
||||
CommitVersion(versionDefinition.IncreaseMinor());
|
||||
if (IncrementButton("Minor", editorVersion.IncreaseMinor()))
|
||||
CommitVersion(editorVersion.IncreaseMinor());
|
||||
|
||||
if (IncrementButton("Patch", versionDefinition.IncreasePatch()))
|
||||
CommitVersion(versionDefinition.IncreasePatch());
|
||||
if (IncrementButton("Patch", editorVersion.IncreasePatch()))
|
||||
CommitVersion(editorVersion.IncreasePatch());
|
||||
|
||||
if (IncrementButton("Release Candidate", versionDefinition.IncreaseReleaseCandidate()))
|
||||
CommitVersion(versionDefinition.IncreaseReleaseCandidate());
|
||||
if (IncrementButton("Release Candidate", editorVersion.IncreaseReleaseCandidate()))
|
||||
CommitVersion(editorVersion.IncreaseReleaseCandidate());
|
||||
|
||||
EditorGUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
private void CommitVersion(VersionDefinition versionDefinition)
|
||||
{
|
||||
if (this.editorVersion >= versionDefinition)
|
||||
if (editorVersion >= versionDefinition)
|
||||
{
|
||||
EditorUtility.DisplayDialog(
|
||||
"Release Conflict",
|
||||
$"You can't create a new version because the old version({this.editorVersion}) is either higher or the same as the new version({versionDefinition}). Please make new commits to create new releases.",
|
||||
$"You can't create a new version because the old version({editorVersion}) is either higher or the same as the new version({versionDefinition}). Please make new commits to create new releases.",
|
||||
"Return");
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorUtility.DisplayDialog(
|
||||
if (!EditorUtility.DisplayDialog(
|
||||
"Release Confirmation",
|
||||
$"Are you sure to commit a new incremental version of {versionDefinition}?",
|
||||
"Yes",
|
||||
@ -109,7 +111,7 @@ public class BuildGeneratorEditorWindow : EditorWindow
|
||||
|
||||
private void ApplyVersion(VersionDefinition versionDefinition)
|
||||
{
|
||||
this.editorVersion = versionDefinition;
|
||||
editorVersion = versionDefinition;
|
||||
PlayerSettings.Android.bundleVersionCode = versionDefinition.BuildNumber;
|
||||
PlayerSettings.iOS.buildNumber = versionDefinition.BuildNumber.ToString();
|
||||
PlayerSettings.bundleVersion = versionDefinition.ToString();
|
||||
@ -172,9 +174,9 @@ public class BuildGeneratorEditorWindow : EditorWindow
|
||||
_minor = _releaseCandidate = 1;
|
||||
}
|
||||
|
||||
public readonly VersionDefinition IncreaseMajor() => new(Major + 1, DEFAULT_MINOR, DEFAULT_PATCH, DEFAULT_RELEASE_CANDIDATE);
|
||||
public readonly VersionDefinition IncreaseMinor() => new(Major, Minor + 1, DEFAULT_PATCH, DEFAULT_RELEASE_CANDIDATE);
|
||||
public readonly VersionDefinition IncreasePatch() => new(Major, Minor, Patch + 1, DEFAULT_RELEASE_CANDIDATE);
|
||||
public readonly VersionDefinition IncreaseMajor() => new(Major + 1, DEFAULT_MINOR, DEFAULT_PATCH, 0);
|
||||
public readonly VersionDefinition IncreaseMinor() => new(Major, Minor + 1, DEFAULT_PATCH, 0);
|
||||
public readonly VersionDefinition IncreasePatch() => new(Major, Minor, Patch + 1, 0);
|
||||
public readonly VersionDefinition IncreaseReleaseCandidate() => new(Major, Minor, Patch, ReleaseCandidate + 1);
|
||||
public readonly VersionDefinition ToReleaseVersion() => new(Major, Minor, Patch, RELEASE_RC_VALUE);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user