diff --git a/src/dlangide/builders/extprocess.d b/src/dlangide/builders/extprocess.d index 4cccd2d..24eaf02 100644 --- a/src/dlangide/builders/extprocess.d +++ b/src/dlangide/builders/extprocess.d @@ -236,6 +236,7 @@ class ExternalProcess { } ExternalProcessState run(char[] program, char[][]args, char[] dir, TextWriter stdoutTarget, TextWriter stderrTarget = null) { + Log.d("ExternalProcess.run ", program, " ", args); _state = ExternalProcessState.None; _program = program; _args = args; @@ -272,29 +273,39 @@ class ExternalProcess { } protected void waitForReadingCompletion() { + Log.d("waitForReadingCompletion - closing stdin"); try { _pipes.stdin.close(); } catch (Exception e) { Log.e("Cannot close stdin for ", _program, " ", e); } + Log.d("waitForReadingCompletion - closed stdin"); try { - if (_stdoutReader && !_stdoutReader.finished) + if (_stdoutReader && !_stdoutReader.finished) { + Log.d("waitForReadingCompletion - waiting for stdout"); _stdoutReader.join(false); + Log.d("waitForReadingCompletion - joined stdout"); + } _stdoutReader = null; } catch (Exception e) { Log.e("Exception while waiting for stdout reading completion for ", _program, " ", e); } try { - if (_stderrReader && !_stderrReader.finished) + if (_stderrReader && !_stderrReader.finished) { + Log.d("waitForReadingCompletion - waiting for stderr"); _stderrReader.join(false); - _stderrReader = null; + _stderrReader = null; + Log.d("waitForReadingCompletion - joined stderr"); + } } catch (Exception e) { Log.e("Exception while waiting for stderr reading completion for ", _program, " ", e); } + Log.d("waitForReadingCompletion - done"); } /// polls all available output from process streams ExternalProcessState poll() { + Log.d("ExternalProcess.poll"); bool res = true; if (_state == ExternalProcessState.Error || _state == ExternalProcessState.None || _state == ExternalProcessState.Stopped) return _state; @@ -315,6 +326,7 @@ class ExternalProcess { /// waits until termination ExternalProcessState wait() { + Log.d("ExternalProcess.wait"); if (_state == ExternalProcessState.Error || _state == ExternalProcessState.None || _state == ExternalProcessState.Stopped) return _state; try { @@ -330,6 +342,7 @@ class ExternalProcess { /// request process stop ExternalProcessState kill() { + Log.d("ExternalProcess.kill"); if (_state == ExternalProcessState.Error || _state == ExternalProcessState.None || _state == ExternalProcessState.Stopped) return _state; if (_state == ExternalProcessState.Running) { diff --git a/src/dlangide/ui/commands.d b/src/dlangide/ui/commands.d index 13c0ac2..c68952f 100644 --- a/src/dlangide/ui/commands.d +++ b/src/dlangide/ui/commands.d @@ -47,8 +47,8 @@ const Action ACTION_FILE_EXIT = new Action(IDEActions.FileExit, "MENU_FILE_EXIT" const Action ACTION_WORKSPACE_BUILD = new Action(IDEActions.BuildWorkspace, "MENU_BUILD_WORKSPACE_BUILD"c); const Action ACTION_WORKSPACE_REBUILD = new Action(IDEActions.RebuildWorkspace, "MENU_BUILD_WORKSPACE_REBUILD"c); const Action ACTION_WORKSPACE_CLEAN = new Action(IDEActions.CleanWorkspace, "MENU_BUILD_WORKSPACE_CLEAN"c); -const Action ACTION_PROJECT_BUILD = new Action(IDEActions.BuildProject, "MENU_BUILD_PROJECT_BUILD"c, null, KeyCode.F7, 0); -const Action ACTION_PROJECT_REBUILD = new Action(IDEActions.RebuildProject, "MENU_BUILD_PROJECT_REBUILD"c, null, KeyCode.F7, KeyFlag.Control); +const Action ACTION_PROJECT_BUILD = new Action(IDEActions.BuildProject, "MENU_BUILD_PROJECT_BUILD"c, "run-build", KeyCode.F7, 0); +const Action ACTION_PROJECT_REBUILD = new Action(IDEActions.RebuildProject, "MENU_BUILD_PROJECT_REBUILD"c, "run-build-clean", KeyCode.F7, KeyFlag.Control); const Action ACTION_PROJECT_CLEAN = new Action(IDEActions.CleanProject, "MENU_BUILD_PROJECT_CLEAN"c, null); const Action ACTION_PROJECT_SET_STARTUP = new Action(IDEActions.SetStartupProject, "MENU_PROJECT_SET_AS_STARTUP"c, null); const Action ACTION_PROJECT_SETTINGS = new Action(IDEActions.ProjectSettings, "MENU_PROJECT_SETTINGS"c, null); diff --git a/src/dlangide/ui/frame.d b/src/dlangide/ui/frame.d index 7bc17cd..3faa8ac 100644 --- a/src/dlangide/ui/frame.d +++ b/src/dlangide/ui/frame.d @@ -147,7 +147,7 @@ class IDEFrame : AppFrame { TabItem tab = _tabs.tab(index); ProjectSourceFile file = cast(ProjectSourceFile)tab.objectParam; if (file) { - setCurrentProject(file.project); + //setCurrentProject(file.project); // tab is source file editor _wsPanel.selectItem(file); focusEditor(file.filename); @@ -341,6 +341,7 @@ class IDEFrame : AppFrame { tb.addButtons(ACTION_DEBUG_START); ToolBarComboBox cbBuildConfiguration = new ToolBarComboBox("buildConfig", ["Debug"d, "Release"d, "Unittest"d]); tb.addControl(cbBuildConfiguration); + tb.addButtons(ACTION_PROJECT_BUILD); tb = res.getOrAddToolbar("Edit"); tb.addButtons(ACTION_EDIT_COPY, ACTION_EDIT_PASTE, ACTION_EDIT_CUT, ACTION_SEPARATOR, @@ -474,15 +475,10 @@ class IDEFrame : AppFrame { _wsPanel.workspace = ws; } - Project currentProject; - void setCurrentProject(Project project) { - currentProject = project; - } - void buildProject() { - if (!currentProject) + if (!currentWorkspace || !currentWorkspace.startupProject) return; - Builder op = new Builder(this, currentProject, _logPanel); + Builder op = new Builder(this, currentWorkspace.startupProject, _logPanel); setBackgroundOperation(op); } } diff --git a/src/dlangide/workspace/workspace.d b/src/dlangide/workspace/workspace.d index 7067a94..9727b54 100644 --- a/src/dlangide/workspace/workspace.d +++ b/src/dlangide/workspace/workspace.d @@ -38,6 +38,16 @@ class Workspace : WorkspaceItem { return _projects; } + protected Project _startupProject; + + @property Project startupProject() { return _startupProject; } + @property void startupProject(Project project) { _startupProject = project; } + + protected void fillStartupProject() { + if (!_startupProject && _projects.length) + _startupProject = _projects[0]; + } + /// tries to find source file in one of projects, returns found project source file item, or null if not found ProjectSourceFile findSourceFileItem(string filename) { foreach (Project p; _projects) { @@ -60,6 +70,7 @@ class Workspace : WorkspaceItem { void addProject(Project p) { _projects ~= p; p.workspace = this; + fillStartupProject(); } string absoluteToRelativePath(string path) { @@ -130,6 +141,7 @@ class Workspace : WorkspaceItem { Log.e("Cannot read workspace file", e); return false; } + fillStartupProject(); return true; } void close() { diff --git a/views/res/mdpi/configure.png b/views/res/mdpi/configure.png new file mode 100644 index 0000000..0c2f5ea Binary files /dev/null and b/views/res/mdpi/configure.png differ diff --git a/views/res/mdpi/run-build-clean.png b/views/res/mdpi/run-build-clean.png new file mode 100644 index 0000000..c104040 Binary files /dev/null and b/views/res/mdpi/run-build-clean.png differ diff --git a/views/res/mdpi/run-build-configure.png b/views/res/mdpi/run-build-configure.png new file mode 100644 index 0000000..faf2185 Binary files /dev/null and b/views/res/mdpi/run-build-configure.png differ diff --git a/views/res/mdpi/run-build.png b/views/res/mdpi/run-build.png new file mode 100644 index 0000000..3ae4c73 Binary files /dev/null and b/views/res/mdpi/run-build.png differ diff --git a/views/resources.list b/views/resources.list index 0e90c77..383c363 100644 --- a/views/resources.list +++ b/views/resources.list @@ -16,4 +16,7 @@ res/mdpi/edit-redo.png res/mdpi/edit-undo.png res/mdpi/project-development.png res/mdpi/project-open.png +res/mdpi/run-build.png +res/mdpi/run-build-clean.png +res/mdpi/run-build-configure.png res/mdpi/tx_fabric.jpg