private void InternalBuild() { // TODO: auto start option(warning: use proper working dir!) foreach (var target in SelectedPreset.Targets) { try { BuildPipelineHelper.Build(target); } catch (Exception ex) { Debug.LogError("Failed to build target: " + target.Name + " error: " + ex); } } // If the last target is marked as not cleaning the defines // ignore this function call. if (!SelectedPreset.Targets.Last().DoNotCleanDefines) { // reset the directives ResetDefines(); } // increase build number TODO: build counting }
// private private void DrawPresetEditor() { _editorScroll = GUILayout.BeginScrollView(_editorScroll); { GUILayout.BeginHorizontal("box"); { if (GUILayout.Button("help", GUILayout.Width(70.0f))) { // TODO: Start documentation using something like: Process.Start("http://myhalp.github.io/docs/Cooker"); } if (GUILayout.Button("save", GUILayout.Width(70.0f))) { _cookerManager.Save(); } if (GUILayout.Button("rename", GUILayout.Width(70.0f))) { _nameReader = new CookerNameReader("Change target name", readName => { GUI.FocusControl(null); _cookerManager.SelectedTarget.Name = readName; _cookerManager.Save(); _nameReader = null; }, delegate { _nameReader = null; }); } if (GUILayout.Button("use defines", GUILayout.Width(90.0f))) { BuildPipelineHelper.SetDefines(_cookerManager.SelectedTarget); } } GUILayout.EndHorizontal(); var target = _cookerManager.SelectedTarget; // basic settings EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Target configuration (" + target.Name + ")"); EditorGUILayout.Space(); target.ExecutableName = EditorGUILayout.TextField("Executable file name", target.ExecutableName); target.OutputName = EditorGUILayout.TextField("Output folder name", target.OutputName); if (target.Type != CookerPreset.Target.BuildType.Debug) { target.Headless = EditorGUILayout.Toggle("Headless", target.Headless); } target.Type = (CookerPreset.Target.BuildType)EditorGUILayout.EnumPopup("Build type", target.Type); target.BuildTarget = (BuildTarget)EditorGUILayout.EnumPopup("Build target", target.BuildTarget); // content building EditorGUILayout.Space(); target.DoNotCleanDefines = EditorGUILayout.Toggle("Do not clean defines", target.DoNotCleanDefines); target.BuildContent = EditorGUILayout.Toggle("Build Content (asset bundles)", target.BuildContent); target.ContentDirectoryName = EditorGUILayout.TextField("Content directory name", target.ContentDirectoryName); target.ContentBuildOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumFlagsField("Content build options", target.ContentBuildOptions); // build actions directives EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Pre build action"); target.PreBuildAction = EditorGUILayout.TextArea(target.PreBuildAction, GUILayout.Height(50)); GUILayout.Label("Post build action"); target.PostBuildAction = EditorGUILayout.TextArea(target.PostBuildAction, GUILayout.Height(50)); // build directives EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.Label("Scripting define symbols"); EditorGUILayout.Space(); GUILayout.BeginHorizontal(); if (GUILayout.Button("add define", GUILayout.Width(150.0f))) { // add new define // check if directive array is null, if so, create new one with one directive if (target.DefineSymbols == null) { target.DefineSymbols = new[] { "" }; } else { var list = new List <string>(target.DefineSymbols) { "NEW_DIRECTIVE" }; target.DefineSymbols = list.ToArray(); } } if (GUILayout.Button("see builtin symbols", GUILayout.Width(150.0f))) { // TODO: start docs } GUILayout.EndHorizontal(); EditorGUILayout.Space(); if (target.DefineSymbols != null) { for (var i = 0; i < target.DefineSymbols.Length; i++) { GUILayout.BeginHorizontal(); target.DefineSymbols[i] = GUILayout.TextField(target.DefineSymbols[i]); if (GUILayout.Button("x", GUILayout.Width(25.0f))) { // safe delete directive var list = new List <string>(target.DefineSymbols); list.RemoveAt(i); target.DefineSymbols = list.ToArray(); return; } GUILayout.EndHorizontal(); } } } GUILayout.EndScrollView(); }
/// <summary> /// Resets defines. /// </summary> public void ResetDefines() { BuildPipelineHelper.SetDefines(Presets.ToArray()); }