mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Internal Builder does not use Spawner for now
This commit is contained in:
parent
71f9b034c8
commit
bdebf10e1a
1 changed files with 27 additions and 1 deletions
|
@ -20,6 +20,7 @@ import java.util.Map;
|
||||||
import org.eclipse.cdt.core.CommandLauncher;
|
import org.eclipse.cdt.core.CommandLauncher;
|
||||||
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
import org.eclipse.cdt.managedbuilder.internal.core.ManagedMakeMessages;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.SubProgressMonitor;
|
import org.eclipse.core.runtime.SubProgressMonitor;
|
||||||
|
|
||||||
|
@ -37,9 +38,28 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
private IBuildCommand fCmd;
|
private IBuildCommand fCmd;
|
||||||
private Process fProcess;
|
private Process fProcess;
|
||||||
private String fErrMsg;
|
private String fErrMsg;
|
||||||
|
private boolean fUseSpawner;
|
||||||
|
|
||||||
private static final String BUILDER_MSG_HEADER = "InternalBuilder.msg.header"; //$NON-NLS-1$
|
private static final String BUILDER_MSG_HEADER = "InternalBuilder.msg.header"; //$NON-NLS-1$
|
||||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
private static final String LINE_SEPARATOR = System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
|
protected class SpawnerfreeLauncher extends CommandLauncher{
|
||||||
|
|
||||||
|
public Process execute(IPath commandPath, String[] args, String[] env, IPath changeToDirectory) {
|
||||||
|
try {
|
||||||
|
// add platform specific arguments (shell invocation)
|
||||||
|
fCommandArgs = constructCommandArray(commandPath.toOSString(), args);
|
||||||
|
fProcess = Runtime.getRuntime().exec(fCommandArgs, env, changeToDirectory.toFile());
|
||||||
|
// ProcessFactory.getFactory().exec(fCommandArgs, env, changeToDirectory.toFile());
|
||||||
|
fErrorMessage = ""; //$NON-NLS-1$
|
||||||
|
} catch (IOException e) {
|
||||||
|
setErrorMessage(e.getMessage());
|
||||||
|
fProcess = null;
|
||||||
|
}
|
||||||
|
return fProcess;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected class OutputStreamWrapper extends OutputStream {
|
protected class OutputStreamWrapper extends OutputStream {
|
||||||
private OutputStream fOut;
|
private OutputStream fOut;
|
||||||
|
|
||||||
|
@ -86,7 +106,7 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
monitor.beginTask("", getNumCommands()); //$NON-NLS-1$
|
monitor.beginTask("", getNumCommands()); //$NON-NLS-1$
|
||||||
monitor.subTask(""/*getCommandLine()*/); //$NON-NLS-1$
|
monitor.subTask(""/*getCommandLine()*/); //$NON-NLS-1$
|
||||||
|
|
||||||
CommandLauncher launcher = new CommandLauncher();
|
CommandLauncher launcher = createLauncher();
|
||||||
int status = STATUS_OK;
|
int status = STATUS_OK;
|
||||||
|
|
||||||
launcher.showCommand(true);
|
launcher.showCommand(true);
|
||||||
|
@ -132,6 +152,12 @@ public class CommandBuilder implements IBuildModelBuilder {
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected CommandLauncher createLauncher() {
|
||||||
|
if(fUseSpawner)
|
||||||
|
return new CommandLauncher();
|
||||||
|
return new SpawnerfreeLauncher();
|
||||||
|
}
|
||||||
|
|
||||||
public String getErrMsg(){
|
public String getErrMsg(){
|
||||||
return fErrMsg;
|
return fErrMsg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue