use of com.goide.util.GoHistoryProcessListener in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoBuildingRunner method prepare.
@NotNull
@Override
protected Promise<RunProfileStarter> prepare(@NotNull ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException {
File outputFile = getOutputFile(environment, (GoApplicationRunningState) state);
FileDocumentManager.getInstance().saveAllDocuments();
AsyncPromise<RunProfileStarter> buildingPromise = new AsyncPromise<>();
GoHistoryProcessListener historyProcessListener = new GoHistoryProcessListener();
((GoApplicationRunningState) state).createCommonExecutor().withParameters("build").withParameterString(((GoApplicationRunningState) state).getGoBuildParams()).withParameters("-o", outputFile.getAbsolutePath()).withParameters(((GoApplicationRunningState) state).isDebug() ? new String[] { "-gcflags", "-N -l" } : ArrayUtil.EMPTY_STRING_ARRAY).withParameters(((GoApplicationRunningState) state).getTarget()).disablePty().withPresentableName("go build").withProcessListener(historyProcessListener).withProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
super.processTerminated(event);
boolean compilationFailed = event.getExitCode() != 0;
if (((GoApplicationRunningState) state).isDebug()) {
buildingPromise.setResult(new MyDebugStarter(outputFile.getAbsolutePath(), historyProcessListener, compilationFailed));
} else {
buildingPromise.setResult(new MyRunStarter(outputFile.getAbsolutePath(), historyProcessListener, compilationFailed));
}
}
}).executeWithProgress(false);
return buildingPromise;
}
Aggregations