update builder

This commit is contained in:
Vadim Lopatin 2015-01-29 11:54:13 +03:00
parent 73604e115c
commit 70326b65a4
9 changed files with 37 additions and 13 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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);
}
}

View File

@ -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() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 865 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

View File

@ -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