mirror of https://github.com/buggins/dlangide.git
rewrite rdmd execution
This commit is contained in:
parent
f8fe92aa77
commit
3f3b3d2fc0
|
@ -16,7 +16,6 @@ alias BuildResultListener = void delegate(int);
|
||||||
|
|
||||||
class Builder : BackgroundOperationWatcher {
|
class Builder : BackgroundOperationWatcher {
|
||||||
protected Project _project;
|
protected Project _project;
|
||||||
protected string _filename; // for rdmd
|
|
||||||
protected ExternalProcess _extprocess;
|
protected ExternalProcess _extprocess;
|
||||||
protected OutputPanel _log;
|
protected OutputPanel _log;
|
||||||
protected ProtectedTextStorage _box;
|
protected ProtectedTextStorage _box;
|
||||||
|
@ -55,23 +54,6 @@ class Builder : BackgroundOperationWatcher {
|
||||||
_box = new ProtectedTextStorage();
|
_box = new ProtectedTextStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
this(AppFrame frame, string filename, OutputPanel log, BuildConfiguration buildConfig,
|
|
||||||
BuildOperation buildOp,
|
|
||||||
string rdmdExecutable,
|
|
||||||
string rdmdAdditionalParams,
|
|
||||||
BuildResultListener listener = null) {
|
|
||||||
super(frame);
|
|
||||||
_listener = listener;
|
|
||||||
_buildOp = buildOp;
|
|
||||||
_filename = filename;
|
|
||||||
_buildConfig = buildConfig;
|
|
||||||
_executable = rdmdExecutable.empty ? "rdmd" : rdmdExecutable;
|
|
||||||
_additionalParams = rdmdAdditionalParams;
|
|
||||||
_log = log;
|
|
||||||
_extprocess = new ExternalProcess();
|
|
||||||
_box = new ProtectedTextStorage();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// log lines
|
/// log lines
|
||||||
void pollText() {
|
void pollText() {
|
||||||
dstring text = _box.readText();
|
dstring text = _box.readText();
|
||||||
|
@ -90,31 +72,10 @@ class Builder : BackgroundOperationWatcher {
|
||||||
_log.clear();
|
_log.clear();
|
||||||
char[] program = _executable.dup;
|
char[] program = _executable.dup;
|
||||||
char[][] params;
|
char[][] params;
|
||||||
char[] dir;
|
char[] dir = _project.dir.dup;
|
||||||
|
|
||||||
if(_buildOp == BuildOperation.RunWithRdmd) {
|
{
|
||||||
dir = std.path.dirName(_filename).dup;
|
|
||||||
|
|
||||||
if (!_additionalParams.empty)
|
|
||||||
params ~= _additionalParams.dup;
|
|
||||||
|
|
||||||
switch (_buildConfig) {
|
|
||||||
default:
|
|
||||||
case BuildConfiguration.Debug:
|
|
||||||
params ~= "-debug".dup;
|
|
||||||
break;
|
|
||||||
case BuildConfiguration.Release:
|
|
||||||
params ~= "-release".dup;
|
|
||||||
break;
|
|
||||||
case BuildConfiguration.Unittest:
|
|
||||||
params ~= "-unittest".dup;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
params ~= std.path.baseName(_filename).dup;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
// dub
|
// dub
|
||||||
dir = _project.dir.dup;
|
|
||||||
if (_buildOp == BuildOperation.Build || _buildOp == BuildOperation.Rebuild) {
|
if (_buildOp == BuildOperation.Build || _buildOp == BuildOperation.Rebuild) {
|
||||||
params ~= "build".dup;
|
params ~= "build".dup;
|
||||||
if (_buildOp == BuildOperation.Rebuild) {
|
if (_buildOp == BuildOperation.Rebuild) {
|
||||||
|
|
|
@ -245,7 +245,7 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
window.showMessageBox(UIString("Cannot run project"d), UIString("Cannot find executable file"d));
|
window.showMessageBox(UIString("Cannot run project"d), UIString("Cannot find executable file"d));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ProgramExecutionNoDebug program = new ProgramExecutionNoDebug();
|
auto program = new ProgramExecutionNoDebug;
|
||||||
setExecutableParameters(program, project, executableFileName);
|
setExecutableParameters(program, project, executableFileName);
|
||||||
program.setProgramExecutionStatusListener(this);
|
program.setProgramExecutionStatusListener(this);
|
||||||
_execution = program;
|
_execution = program;
|
||||||
|
@ -273,6 +273,48 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runWithRdmd(string filename) {
|
||||||
|
stopExecution();
|
||||||
|
|
||||||
|
string rdmdExecutable = _settings.rdmdExecutable;
|
||||||
|
|
||||||
|
auto program = new ProgramExecutionNoDebug;
|
||||||
|
string sourceFileName = baseName(filename);
|
||||||
|
string workingDirectory = dirName(filename);
|
||||||
|
string[] args;
|
||||||
|
{
|
||||||
|
string rdmdAdditionalParams = _settings.rdmdAdditionalParams;
|
||||||
|
if (!rdmdAdditionalParams.empty)
|
||||||
|
args ~= rdmdAdditionalParams.split();
|
||||||
|
|
||||||
|
auto buildConfig = currentWorkspace ? currentWorkspace.buildConfiguration : BuildConfiguration.Debug;
|
||||||
|
switch (buildConfig) {
|
||||||
|
default:
|
||||||
|
case BuildConfiguration.Debug:
|
||||||
|
args ~= "-debug";
|
||||||
|
break;
|
||||||
|
case BuildConfiguration.Release:
|
||||||
|
args ~= "-release";
|
||||||
|
break;
|
||||||
|
case BuildConfiguration.Unittest:
|
||||||
|
args ~= "-unittest";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
args ~= sourceFileName;
|
||||||
|
}
|
||||||
|
version(Windows) {
|
||||||
|
} else {
|
||||||
|
string externalConsoleExecutable = _settings.terminalExecutable;
|
||||||
|
}
|
||||||
|
_logPanel.logLine("Starting " ~ sourceFileName ~ " with rdmd");
|
||||||
|
_statusLine.setBackgroundOperationStatus("run-rdmd", "running..."d);
|
||||||
|
program.setExecutableParams(rdmdExecutable, args, workingDirectory, null);
|
||||||
|
program.setTerminalExecutable(externalConsoleExecutable);
|
||||||
|
program.setProgramExecutionStatusListener(this);
|
||||||
|
_execution = program;
|
||||||
|
program.run();
|
||||||
|
}
|
||||||
|
|
||||||
override protected void initialize() {
|
override protected void initialize() {
|
||||||
_appName = "dlangide";
|
_appName = "dlangide";
|
||||||
//_editorTool = new DEditorTool(this);
|
//_editorTool = new DEditorTool(this);
|
||||||
|
@ -1343,16 +1385,6 @@ class IDEFrame : AppFrame, ProgramExecutionStatusListener, BreakpointListChangeL
|
||||||
setBackgroundOperation(op);
|
setBackgroundOperation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
void runWithRdmd(string filename, BuildResultListener listener = null) {
|
|
||||||
string rdmdExecutable = _settings.rdmdExecutable;
|
|
||||||
string rdmdAdditionalParams = _settings.rdmdAdditionalParams;
|
|
||||||
Builder op = new Builder(this, filename, _logPanel, currentWorkspace ? currentWorkspace.buildConfiguration : BuildConfiguration.Debug,
|
|
||||||
BuildOperation.RunWithRdmd,
|
|
||||||
rdmdExecutable, rdmdAdditionalParams,
|
|
||||||
listener);
|
|
||||||
setBackgroundOperation(op);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// updates list of available configurations
|
/// updates list of available configurations
|
||||||
void setProjectConfigurations(dstring[] items) {
|
void setProjectConfigurations(dstring[] items) {
|
||||||
projectConfigurationCombo.items = items;
|
projectConfigurationCombo.items = items;
|
||||||
|
|
|
@ -19,8 +19,7 @@ enum BuildOperation {
|
||||||
Clean,
|
Clean,
|
||||||
Rebuild,
|
Rebuild,
|
||||||
Run,
|
Run,
|
||||||
Upgrade,
|
Upgrade
|
||||||
RunWithRdmd
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum BuildConfiguration {
|
enum BuildConfiguration {
|
||||||
|
|
Loading…
Reference in New Issue