Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
LANG: API change, needs review of all indirect users of
Browse files Browse the repository at this point in the history
LangProjectBuilderExt.runBuildTool_2()
  • Loading branch information
bruno-medeiros committed Mar 31, 2015
1 parent a32366e commit bbf7462
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,12 @@
package melnorme.lang.ide.core.operations;

import melnorme.lang.ide.core.ILangOperationsListener_Actual;
import melnorme.lang.ide.core.utils.EclipseUtils;
import melnorme.lang.ide.core.utils.ResourceUtils;
import melnorme.lang.ide.core.utils.process.AbstractRunProcessTask;
import melnorme.lang.ide.core.utils.process.RunExternalProcessTask;
import melnorme.lang.tooling.data.StatusLevel;
import melnorme.utilbox.concurrency.OperationCancellation;
import melnorme.utilbox.core.CommonException;
import melnorme.utilbox.misc.ListenerListHelper;
import melnorme.utilbox.misc.Location;
import melnorme.utilbox.process.ExternalProcessHelper.ExternalProcessResult;
import melnorme.utilbox.process.ExternalProcessNotifyingHelper;

Expand Down Expand Up @@ -56,30 +53,10 @@ public RunExternalProcessTask newRunToolTask(ProcessBuilder pb, IProject project
return new RunExternalProcessTask(pb, project, pm, this);
}

public ExternalProcessResult runTool(IProject project, IProgressMonitor pm, ProcessBuilder pb)
throws CoreException, OperationCancellation {
// Note: project can be null
return runTool(project, pm, pb, null, false);
}

public ExternalProcessResult runTool(IProject project, IProgressMonitor pm, ProcessBuilder pb,
String processInput, boolean throwOnNonZero)
throws CoreException, OperationCancellation {
Location workingDir = project == null ? null : ResourceUtils.getProjectLocation(project);
if(workingDir != null) {
pb.directory(workingDir.toFile());
}

EclipseUtils.checkMonitorCancelation(pm);

return newRunToolTask(pb, project, pm).runProcess(processInput, throwOnNonZero);
}

/* ----------------- ----------------- */

public ExternalProcessResult runEngineTool(
ProcessBuilder pb, String clientInput, IProgressMonitor pm
) throws CoreException, OperationCancellation {
public ExternalProcessResult runEngineTool(ProcessBuilder pb, String clientInput, IProgressMonitor pm)
throws CoreException, OperationCancellation {
return new RunEngineClientOperation(pb, pm).runProcess(clientInput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ public LangProjectBuilderExt() {
super();
}

protected ExternalProcessResult runBuildTool(IProgressMonitor monitor, ProcessBuilder pb)
protected ExternalProcessResult runBuildTool_2(IProgressMonitor monitor, ProcessBuilder pb)
throws CoreException, OperationCancellation {
return getToolManager().runTool(getProject(), monitor, pb);
return getToolManager().newRunToolTask(pb, getProject(), monitor).runProcess();
}

protected ExternalProcessResult runBuildTool(IProgressMonitor monitor, ArrayList2<String> toolCmdLine)
throws CoreException, OperationCancellation {
ProcessBuilder pb = ProcessUtils.createProcessBuilder(toolCmdLine, null);
return runBuildTool(monitor, pb);
ProcessBuilder pb = createProcessBuilder(toolCmdLine);
return runBuildTool_2(monitor, pb);
}

protected ProcessBuilder createProcessBuilder(ArrayList2<String> toolCmdLine) throws CoreException {
return ProcessUtils.createProcessBuilder(toolCmdLine, getProjectLocation());
}

protected Location getProjectLocation() throws CoreException {
Expand Down Expand Up @@ -75,7 +79,7 @@ public IProject[] execute(IProject project, IProgressMonitor monitor)

ProcessBuilder pb = createBuildPB();

ExternalProcessResult buildAllResult = runBuildTool(monitor, pb);
ExternalProcessResult buildAllResult = runBuildTool_2(monitor, pb);
doBuild_processBuildResult(buildAllResult);

return null;
Expand All @@ -102,10 +106,10 @@ protected void clean(IProgressMonitor monitor) throws CoreException {
}
}

protected abstract ProcessBuilder createCleanPB() throws CoreException;

protected void doClean(IProgressMonitor monitor, ProcessBuilder pb) throws CoreException, OperationCancellation {
runBuildTool(monitor, pb);
runBuildTool_2(monitor, pb);
}

protected abstract ProcessBuilder createCleanPB() throws CoreException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
import java.io.File;
import java.util.List;

import melnorme.utilbox.misc.Location;
import melnorme.utilbox.misc.MiscUtil;

public class ProcessUtils {


public static ProcessBuilder createProcessBuilder(List<String> commandLine, Location workingDir) {
return createProcessBuilder(commandLine, workingDir.toFile());
}

public static ProcessBuilder createProcessBuilder(List<String> commandLine, File workingDir) {
assertTrue(commandLine.size() > 0);

Expand Down

0 comments on commit bbf7462

Please sign in to comment.