private static void DrawGeneralBlock(string searchContext) { if (BuildManagerUtility.TryMatchSearch(searchContext, ShowUserPreferencesLabel.text)) { if (GUILayout.Button(ShowUserPreferencesLabel)) { SettingsService.OpenUserPreferences(BuildManagerUtility.UserPreferencesPath); } EditorGUILayout.Separator(); } if (ShowSplashScreenSetting != BoolState.Null) { PlayerSettings.SplashScreen.show = ShowSplashScreen; } if (ShowUnityLogoSetting != BoolState.Null) { PlayerSettings.SplashScreen.showUnityLogo = ShowUnityLogo; } using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { UseProjectFolderAsBuildNameSetting.value = SettingsGUILayout.SettingsToggle(UseProjectFolderAsBuildNameLabel, UseProjectFolderAsBuildNameSetting, searchContext); BuildManagerUtility.DrawBoolStateField(searchContext, ShowSplashScreenLabel, ShowSplashScreenSetting, PlayerSettings.SplashScreen.show, delegate { PlayerSettings.SplashScreen.show = ShowSplashScreen; }); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!ShowSplashScreen)) { BuildManagerUtility.DrawBoolStateField(searchContext, ShowUnityLogoLabel, ShowUnityLogoSetting, PlayerSettings.SplashScreen.showUnityLogo, delegate { PlayerSettings.SplashScreen.showUnityLogo = ShowUnityLogo; }); } } UseUtcNowAsIosBuildNumberSetting.value = SettingsGUILayout.SettingsToggle(UseUtcNowAsIosBuildNumberLabel, UseUtcNowAsIosBuildNumberSetting, searchContext); UseUtcNowAsMacBuildNumberSetting.value = SettingsGUILayout.SettingsToggle(UseUtcNowAsMacBuildNumberLabel, UseUtcNowAsMacBuildNumberSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } }
private static void DrawCloudBuildsBlock(string searchContext) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { AppendBuildNumberToVersionSetting.value = SettingsGUILayout.SettingsToggle(AppendBuildNumberToVersionLabel, AppendBuildNumberToVersionSetting, searchContext); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!AppendBuildNumberToVersionSetting)) { if (BuildManagerUtility.TryMatchSearch(searchContext, BuildNumberExpressionLabel.text)) { BuildNumberExpressionSetting.value = EditorGUILayout.TextField(BuildNumberExpressionLabel, BuildNumberExpressionSetting); SettingsGUILayout.DoResetContextMenuForLastRect(BuildNumberExpressionSetting); Rect position = EditorGUILayout.GetControlRect(true); position.xMin += EditorGUIUtility.labelWidth; if (GUI.Button(position, "Validate")) { string buildNumber = Random.Range(1, 100).ToString(); string original = BuildNumberExpressionSetting; string replaced = original.Replace(BuildNumberPlaceholder, buildNumber); if (ExpressionEvaluator.Evaluate(replaced, out int result)) { Debug.Log($"Expression ({original}) is valid! Validated with Build Number {buildNumber}: ({replaced})={result}"); } else { Debug.LogError($"({original}) is not a valid expression!"); } } } } } UseBuildStartTimeAsUtcNowSetting.value = SettingsGUILayout.SettingsToggle(UseBuildStartTimeAsUtcNowLabel, UseBuildStartTimeAsUtcNowSetting, searchContext); SumBuildNumberToBundleVersionCodeSetting.value = SettingsGUILayout.SettingsToggle(SumBuildNumberToBundleVersionCodeLabel, SumBuildNumberToBundleVersionCodeSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } }
private static void CopyAllFilesAsync(string originalOutputPath, string standardOutputPath) { if (Directory.Exists(standardOutputPath)) { Directory.Delete(standardOutputPath, true); } void action(string sourceFile) { string destinationFile = $"{standardOutputPath}/{sourceFile.Remove(0, originalOutputPath.Length)}"; BuildManagerUtility.EnsureDirectoryExists(Path.GetDirectoryName(destinationFile)); File.Copy(sourceFile, destinationFile); } string[] files = Directory.GetFiles(originalOutputPath, "*", SearchOption.AllDirectories); Parallel.ForEach(files, action); }
private static void CopyAllFilesAsync(string originalOutputPath, string standardOutputFolderPath, string buildName) { if (Directory.Exists(standardOutputFolderPath)) { Directory.Delete(standardOutputFolderPath, true); } string originalOutputFolderPath = Path.GetDirectoryName(originalOutputPath); string originalOutputFileName = Path.GetFileNameWithoutExtension(originalOutputPath); Assert.IsFalse(string.IsNullOrWhiteSpace(originalOutputFolderPath)); string ignoredFolder = Path.Combine(originalOutputFolderPath, $"{originalOutputFileName}{IgnoredFolderSuffix}"); void action(string sourceFile) { if (sourceFile.StartsWith(ignoredFolder)) { return; } string relativePath = sourceFile.Remove(0, originalOutputFolderPath.Length + 1); string standardOutputFileName; if (relativePath.StartsWith(originalOutputFileName)) { standardOutputFileName = $"{buildName}{relativePath.Remove(0, originalOutputFileName.Length)}"; } else { standardOutputFileName = relativePath; } string destinationFile = $"{standardOutputFolderPath}/{standardOutputFileName}"; BuildManagerUtility.EnsureDirectoryExists(Path.GetDirectoryName(destinationFile)); File.Copy(sourceFile, destinationFile); } string[] files = Directory.GetFiles(originalOutputFolderPath, "*", SearchOption.AllDirectories); Parallel.ForEach(files, action); }
private static void DrawLocalBuildsBlock(string searchContext) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { AllowFallbackToMonoSetting.value = SettingsGUILayout.SettingsToggle(AllowFallbackToMonoLabel, AllowFallbackToMonoSetting, searchContext); using (new EditorGUI.IndentLevelScope()) { using (new EditorGUI.DisabledScope(!AllowFallbackToMonoSetting)) { BuildManagerUtility.DrawEnumField(searchContext, PreferredLinuxScriptingBackendLabel, PreferredLinuxScriptingBackendSetting, null); BuildManagerUtility.DrawEnumField(searchContext, PreferredMacScriptingBackendLabel, PreferredMacScriptingBackendSetting, null); BuildManagerUtility.DrawEnumField(searchContext, PreferredWindowsScriptingBackendLabel, PreferredWindowsScriptingBackendSetting, null); } } if (changeCheckScope.changed) { Settings.Save(); } } }
private static void DrawHeaderBlock(string searchContext) { if (BuildManagerUtility.TryMatchSearch(searchContext, ShowProjectSettingsLabel.text)) { if (GUILayout.Button(ShowProjectSettingsLabel)) { SettingsService.OpenProjectSettings(BuildManagerUtility.ProjectSettingsPath); } EditorGUILayout.Separator(); } using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { if (BuildManagerUtility.TryMatchSearch(searchContext, OpenBuiltPlayerOptionsLabel.text)) { OpenBuiltPlayerOptionsSetting.value = (OpenBuiltPlayerOptions)EditorGUILayout.EnumFlagsField(OpenBuiltPlayerOptionsLabel, OpenBuiltPlayerOptionsSetting); SettingsGUILayout.DoResetContextMenuForLastRect(OpenBuiltPlayerOptionsSetting); } CreateStandardizedBuildOutputSetting.value = SettingsGUILayout.SettingsToggle(CreateStandardizedBuildOutputLabel, CreateStandardizedBuildOutputSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } } using (new EditorGUI.DisabledScope(!CreateStandardizedBuildOutputSetting)) { using (EditorGUI.ChangeCheckScope changeCheckScope = new EditorGUI.ChangeCheckScope()) { using (new EditorGUI.IndentLevelScope()) { GroupByBuildNameSetting.value = SettingsGUILayout.SettingsToggle(GroupByBuildNameLabel, GroupByBuildNameSetting, searchContext); GroupByBuildTargetSetting.value = SettingsGUILayout.SettingsToggle(GroupByBuildTargetLabel, GroupByBuildTargetSetting, searchContext); if (changeCheckScope.changed) { Settings.Save(); } if (!BuildManagerUtility.TryMatchSearch(searchContext, StandardizedBuildOutputPathLabel.text) && !BuildManagerUtility.TryMatchSearch(searchContext, ChangeButtonLabel.text)) { return; } Rect position = EditorGUILayout.GetControlRect(); position = EditorGUI.PrefixLabel(position, StandardizedBuildOutputPathLabel); if (GUI.Button(position, ChangeButtonLabel, EditorStyles.miniButton)) { string value = EditorUtility.OpenFolderPanel("Builds folder location", Path.GetDirectoryName(StandardizedBuildOutputPath), Path.GetFileName(StandardizedBuildOutputPath)); if (string.IsNullOrEmpty(value) == false) { StandardizedBuildOutputPathSetting.SetValue(value, true); } } SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting); position = EditorGUILayout.GetControlRect(); if (Event.current.type == EventType.MouseUp && Event.current.button == 0 && position.Contains(Event.current.mousePosition)) { string path = Directory.Exists(StandardizedBuildOutputPath) ? StandardizedBuildOutputPath : Path.GetDirectoryName(Application.dataPath); Assert.IsFalse(string.IsNullOrWhiteSpace(path)); Process.Start(path); } string outputLabel = StandardizedBuildOutputPathSetting == DefaultStandardizedBuildOutputPath ? $"./{DefaultStandardizedBuildOutputPath}" : StandardizedBuildOutputPath; EditorGUI.LabelField(position, outputLabel, EditorStyles.miniLabel); SettingsGUILayout.DoResetContextMenuForLastRect(StandardizedBuildOutputPathSetting); } } } }