void DrawHeader() { GUILayout.Space(10); EditorGUILayout.LabelField("The combined changes from all changes files in the active configuration. These will be applied to the Xcode project.", EditorStyles.wordWrappedLabel); GUILayout.Space(10); var activeConfigLabel = new GUIContent("Active Configuration"); float width = EditorStyles.boldLabel.CalcSize(activeConfigLabel).x; var platformConfiguration = XcodeController.Instance().Configuration(Parent.Platform); var configs = platformConfiguration.Configurations; var activeConfig = platformConfiguration.ActiveConfiguration; int activeIndex = System.Array.IndexOf(configs, activeConfig); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(activeConfigLabel, EditorStyles.boldLabel, GUILayout.Width(width)); if (activeIndex < 0) { EditorGUILayout.LabelField(activeConfig); } else { EditorGUI.BeginChangeCheck(); activeIndex = EditorGUILayout.Popup(activeIndex, configs); if (EditorGUI.EndChangeCheck()) { platformConfiguration.ActiveConfiguration = configs[activeIndex]; LoadMergedFile(); } } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); GUILayout.Space(5); }
void DrawDefaultConfig() { bool selected = (PlatformConfiguration.DEFAULT_CONFIG_NAME == _platformConfiguration.ActiveConfiguration); GUI.backgroundColor = (selected ? Color.yellow : Color.white); EditorGUI.BeginChangeCheck(); bool enable = EditorGUILayout.ToggleLeft(" " + PlatformConfiguration.DEFAULT_CONFIG_NAME, selected, EditorStyles.boldLabel); if (EditorGUI.EndChangeCheck() && !selected && enable) { _platformConfiguration.ActiveConfiguration = PlatformConfiguration.DEFAULT_CONFIG_NAME; } EditorGUILayout.BeginVertical(_style.IndentedBox()); var changeFiles = XcodeController.Instance().ChangeFiles(_parent.Platform); float labelWidth = 200.0f; foreach (var changeFile in changeFiles) { float width = EditorStyles.label.CalcSize(new GUIContent(changeFile)).x; labelWidth = Mathf.Max(labelWidth, width); } foreach (var changeFile in changeFiles) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(changeFile, GUILayout.Width(labelWidth + 20.0f)); EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); }
public ConfigurationsTab(XcodeEditorWindow parent, Styling style) { if (parent == null) { throw new System.ArgumentNullException(nameof(parent), "parent cannot be null"); } _parent = parent; _style = style; _platformConfiguration = XcodeController.Instance().Configuration(_parent.Platform); }
//Set a date value in the Info.plist public static void SetInfoPlistEntry(string key, System.DateTime value) { if (string.IsNullOrEmpty(key)) { return; } var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.InfoPlistChanges[key] = new PListDate(value); }
void LoadMergedFile() { ChangeFile = XcodeController.Instance().MergedChanges(Parent.Platform); UpdateMaxFolderWidth(); SetFoldout(Sections.InfoPlist, ChangeFile.InfoPlistChanges.Count > 0); SetFoldout(Sections.Frameworks, ChangeFile.Frameworks.HasChanges()); SetFoldout(Sections.FilesFolders, ChangeFile.FilesAndFolders.HasChanges()); SetFoldout(Sections.BuildSettings, ChangeFile.BuildSettings.HasChanges()); SetFoldout(Sections.Signing, ChangeFile.Signing.HasChanges()); SetFoldout(Sections.Scripts, ChangeFile.Scripts.HasChanges()); SetFoldout(Sections.Capabilities, ChangeFile.Capabilities.HasChanges()); }
void SaveIfRequired() { if (XcodeController.Instance().IsDirty) { XcodeController.Instance().Save(); } if (_changesTab != null && _changesTab.IsDirty) { _changesTab.Save(); } }
// Set the development team id public static void SetTeamId(string teamId) { if (string.IsNullOrEmpty(teamId)) { Debug.LogError("EgoXproject: Team Id cannot be empty"); return; } var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.Signing.TeamId = teamId; }
void OnEnable() { _settings = XcodeController.Instance().Settings; _customIgnoredFiles.Clear(); _customIgnoredFiles.AddRange(IgnoredFiles.CustomList); if (_style == null) { _style = new Styling(); } _style.Load(); }
//Set the name of the active configuration public static void SetActiveConfigutation(BuildTarget target, string activeConfiguration) { BuildPlatform platform; if (PlatformFromTarget(target, out platform)) { XcodeController.Instance().Configuration(platform).ActiveConfiguration = activeConfiguration; } else { InvalidTargetMessage(); } }
//Get the name of the active configuration public static string ActiveConfiguration(BuildTarget target) { BuildPlatform platform; if (PlatformFromTarget(target, out platform)) { return(XcodeController.Instance().Configuration(platform).ActiveConfiguration); } else { InvalidTargetMessage(); return(""); } }
public static void EnableAutomaticProvisioning(bool enable) { XcodeController.Instance().ScriptingChangeFile.Signing.AutomaticProvisioning = enable; }
//Add a script with a specified shell and name public static void AddScript(string script, string shell, string name) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.Scripts.AddScript(script, shell, name); }
//Set a build setting to a specified value public static void SetBuildSetting(string buildSetting, string value) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.BuildSettings.Add(buildSetting, value); }
//Add a source file //Path must be absolute or relative to the project folder (e.g. "Assets/Third Party/Foo.m") //Set its add method (i.e. whether it should be copied to the Xcode project or just linked) //Set any compiler flags the file may require (e.g. -fobjc-arc) public static void AddSourceFile(string pathToSourceFile, AddMethod addMethod, string compilerFlags) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.FilesAndFolders.AddSourceFile(pathToSourceFile, addMethod, compilerFlags); }
//Add a file or folder //Path must be absolute or relative to the project folder (e.g. "Assets/Third Party/Foo.m") //Set its add method (i.e. whether it should be copied to the Xcode project or just linked) //No attributes will be set public static void AddFileOrFolder(string pathToFileOrFolder, AddMethod addMethod) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.FilesAndFolders.AddFileOrFolder(pathToFileOrFolder, addMethod); }
//Add a custom framework as an embedded framework //Path must be absolute or relative to the project folder (e.g. "Assets/Third Party/Foo.framework") public static void AddEmbeddedFramework(string pathToFramework) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.FilesAndFolders.AddEmbeddedFramework(pathToFramework); }
//Add a custom framework or library. //Path must be absolute or relative to the project folder (e.g. "Assets/Third Party/Foo.framework") //Set its link type (i.e. whether it is Optional or Required). //Set its add method (i.e. whether it should be copied to the Xcode project or just linked) public static void AddCustomFrameworkOrLibrary(string pathToFrameworkOrLibrary, LinkType linkType, AddMethod addMethod) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.FilesAndFolders.AddFrameworkOrLibrary(pathToFrameworkOrLibrary, addMethod, linkType); }
//Add a system framework or library by name (eg. Accelerate.framework), //and set its link type (i.e. whether it is Optional or Required). public static void AddSystemFrameworkOrLibrary(string name, LinkType linkType) { var changeFile = XcodeController.Instance().ScriptingChangeFile; changeFile.Frameworks.Add(name, linkType); }
void DrawConfig(string configName) { bool selected = (configName == _platformConfiguration.ActiveConfiguration); GUI.backgroundColor = (selected ? Color.yellow : Color.white); EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); bool enable = EditorGUILayout.ToggleLeft(" " + configName, selected, EditorStyles.boldLabel, GUILayout.ExpandWidth(true)); if (EditorGUI.EndChangeCheck() && !selected && enable) { _platformConfiguration.ActiveConfiguration = configName; } EditorGUILayout.Space(); if (_style.EditButton("Change name")) { _drawRenameDialog = true; _configToRename = configName; } if (_style.MinusButton("Remove configuration")) { _configToRemove = configName; } GUILayout.Space(20); EditorGUILayout.EndHorizontal(); GUILayout.Space(4); EditorGUILayout.BeginVertical(_style.IndentedBox()); var changeFiles = _platformConfiguration.ChangeFilesInConfiguration(configName); float labelWidth = 200.0f; foreach (var changeFile in changeFiles) { float width = EditorStyles.label.CalcSize(new GUIContent(changeFile)).x; labelWidth = Mathf.Max(labelWidth, width); } string toRemove = ""; foreach (var changeFile in changeFiles) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(changeFile, GUILayout.Width(labelWidth + 20.0f)); EditorGUILayout.Space(); if (_style.MinusButton("Remove change file from configuration")) { if (EditorUtility.DisplayDialog("Remove change file from configuration?", "Are your sure you want to remove the \"" + System.IO.Path.GetFileName(changeFile) + "\" change file from the \"" + configName + "\" configuration?", "Remove", "Cancel")) { toRemove = changeFile; } } EditorGUILayout.EndHorizontal(); GUILayout.Space(4); } if (!string.IsNullOrEmpty(toRemove)) { _platformConfiguration.RemoveChangeFileFromConfiguration(toRemove, configName); } EditorGUILayout.BeginHorizontal(); EditorGUILayout.Space(); GUI.enabled = XcodeController.Instance().ChangeFileCount(_parent.Platform) > 0; if (_style.PlusButton("Add change file to configuration")) { _drawChangeFilesDropDown = true; _configuration = configName; } GUI.enabled = true; EditorGUILayout.EndHorizontal(); GUILayout.Space(4); GUI.backgroundColor = Color.white; EditorGUILayout.EndVertical(); }
//Apply the changes to the specified project. //target is the BuildTarget that gets passed to the PostProcessBuild attributed function. //pathToBuiltProject is the path that gets passed to the PostProcessBuild attributed function. public static void ApplyChanges(BuildTarget target, string pathToBuiltProject) { XcodeController.Instance().ModifyXcodeProject(target, pathToBuiltProject); }
public void Draw() { _drawChangeFilesDropDown = false; _drawRenameDialog = false; _drawAddDialog = false; _configToRemove = ""; GUILayout.Space(10); GUI.enabled = _enableControls; _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); DrawConfiguration(); GUILayout.Space(10); EditorGUILayout.EndScrollView(); if (_drawChangeFilesDropDown) { _drawChangeFilesDropDown = false; var dropSize = new Vector2(400, 300); var dropPos = _parent.position.center - dropSize * 0.5f; var r = new Rect(dropPos.x, dropPos.y, dropSize.x, dropSize.y); var filtered = XcodeController.Instance().ChangeFiles(_parent.Platform).Except(_platformConfiguration.ChangeFilesInConfiguration(_configuration)).ToArray(); ListSelectionPopover.Init(r, "Select a change file", filtered, AddChangeFile, _style); } if (_drawRenameDialog) { _drawRenameDialog = false; Vector2 position = _parent.position.center; TextEditPopover.Init(position, 300, "Rename Configuration", "", _configToRename, HandleOnRename, _platformConfiguration.IsValidConfigurationName, "Rename", _style); } if (_drawAddDialog) { _drawAddDialog = false; Vector2 position = _parent.position.center; TextEditPopover.Init(position, 300, "Add Configuration", "", "", HandleOnAdd, _platformConfiguration.IsValidConfigurationName, "Add", _style); } if (!string.IsNullOrEmpty(_configToRemove)) { if (EditorUtility.DisplayDialog("Remove Configuration?", "Are you sure you want to remove the \"" + _configToRemove + "\" configuration?", "Remove", "Cancel")) { _platformConfiguration.RemoveConfiguration(_configToRemove); } } GUI.enabled = true; }