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