public AutomatedBuild() { if (instance != null && window != null) { window.Close(); } instance = this; }
public static void Init() { if (window != null) { window.Close(); } UpdateGitInfo(); window = CreateInstance <AutomatedBuild>(); window.position = new Rect(Screen.width / 2, Screen.height / 2, 400, 155); window.Repaint(); window.ShowPopup(); if (periodicUpdateRoutine == null) { periodicUpdateRoutine = EditorCoroutineUtility.StartCoroutine(instance.PeriodicUpdateGitInfo(), instance); } }
static void BuildWin64() { AutomatedBuild window = (AutomatedBuild)EditorWindow.GetWindow(typeof(AutomatedBuild)); //window.Show(); var branch = getBranch(); string path; BuildPlayerOptions options; string result; path = "builds/" + branch + "/Editor/"; options = new BuildPlayerOptions { scenes = new string[] { "Assets/Editor.unity" }, locationPathName = path + "360Editor.exe", target = BuildTarget.StandaloneWindows64, options = BuildOptions.Development }; PlayerSettings.virtualRealitySupported = false; result = BuildPipeline.BuildPlayer(options); path = "builds/" + branch + "/Player/"; options = new BuildPlayerOptions { scenes = new string[] { "Assets/Player.unity" }, locationPathName = path + "360Player.exe", target = BuildTarget.StandaloneWindows64, options = BuildOptions.Development }; PlayerSettings.virtualRealitySupported = false; result = BuildPipeline.BuildPlayer(options); path = "builds/" + branch + "/Player-VR/"; options = new BuildPlayerOptions { scenes = new string[] { "Assets/Player.unity" }, locationPathName = path + "360Player.exe", target = BuildTarget.StandaloneWindows64, options = BuildOptions.Development }; PlayerSettings.virtualRealitySupported = true; result = BuildPipeline.BuildPlayer(options); UnityEngine.Debug.Log("Build finished"); //TODO(Kristof): zip all in folder and copy zips one higher }
public void OnGUI() { var margin = new RectOffset(10, 10, 10, 10); GUILayout.BeginVertical(new GUIStyle { margin = margin }); { if (branch == "master") { GUI.contentColor = Color.green; EditorGUILayout.LabelField("Branch is master.", EditorStyles.wordWrappedLabel); } else { GUI.contentColor = Color.red; EditorGUILayout.LabelField($"Branch is {branch}. Official build only allowed on master.", EditorStyles.wordWrappedLabel); } GUILayout.Space(10); if (hasChanges) { GUI.contentColor = Color.red; EditorGUILayout.LabelField("There are uncommitted changes. Official build not allowed.", EditorStyles.wordWrappedLabel); } else { GUI.contentColor = Color.green; EditorGUILayout.LabelField("There are no uncommitted changes", EditorStyles.wordWrappedLabel); } if (!isInnoSetupAvailable) { GUI.contentColor = Color.red; EditorGUILayout.LabelField($"Inno Setup 6 not installed at {innoSetupLocation}. Official build not allowed.", EditorStyles.wordWrappedLabel); } if (!isCodeSigningScriptAvailable) { GUI.contentColor = Color.red; EditorGUILayout.LabelField($"Code signing script was not found at {codeSigningScriptLocation}. Official build not allowed.", EditorStyles.wordWrappedLabel); } if (!isCodeSigningToolAvailable) { GUI.contentColor = Color.red; EditorGUILayout.LabelField($"Code signing tool was not found at {codeSigningToolLocation}. Official build not allowed.", EditorStyles.wordWrappedLabel); } GUI.contentColor = Color.white; GUILayout.Space(10); EditorGUILayout.LabelField($"Last tag number: {lastTag}", EditorStyles.wordWrappedLabel); GUILayout.Space(20); bool hasNewTag = !string.IsNullOrEmpty(newTagNumber); if (!hasNewTag) { GUI.contentColor = Color.red; EditorGUILayout.LabelField("No new tag number filled in. Official build not allowed", EditorStyles.wordWrappedLabel); GUI.contentColor = Color.white; } GUILayout.BeginHorizontal(); { GUILayout.Label("New tag number", GUILayout.Width(100)); newTagNumber = GUILayout.TextField(newTagNumber); } GUILayout.EndHorizontal(); GUILayout.Space(20); GUILayout.BeginHorizontal(); { //NOTE(Simon): Perform local build if (GUILayout.Button("Local build", GUILayout.Height(30))) { BuildWin64(); ShowInWindowsExplorer("builds/" + branch); Close(); } GUI.enabled = branch == "master" && !hasChanges && hasNewTag; //NOTE(Simon): Perform official build if (GUILayout.Button("Official build", GUILayout.Height(30))) { WriteVersionNumber(newTagNumber); CreateNewGitTag(newTagNumber); BuildWin64(); BuildInstallers(); SignInstallers(); RenameInstallers(newTagNumber); ShowInWindowsExplorer("builds/installers"); Close(); } GUI.enabled = true; GUILayout.Space(20); if (GUILayout.Button("Cancel", GUILayout.Height(30))) { if (periodicUpdateRoutine != null) { EditorCoroutineUtility.StopCoroutine(periodicUpdateRoutine); } Close(); window = null; } } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); if (Event.current.type == EventType.Repaint && window != null) { var totalSize = GUILayoutUtility.GetLastRect(); var pos = window.position; pos.height = totalSize.height + margin.top + margin.bottom; window.position = pos; } }