use of com.intellij.execution.DefaultExecutionResult in project android by JetBrains.
the class AndroidRunState method execute.
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
ProcessHandler processHandler;
ConsoleView console;
String applicationId;
try {
applicationId = myApplicationIdProvider.getPackageName();
} catch (ApkProvisionException e) {
throw new ExecutionException("Unable to obtain application id", e);
}
// TODO: this class is independent of gradle, except for this hack
AndroidModuleModel model = AndroidModuleModel.get(myModule);
if (InstantRunSettings.isInstantRunEnabled() && InstantRunGradleUtils.getIrSupportStatus(model, null) == InstantRunGradleSupport.SUPPORTED) {
assert model != null;
InstantRunBuildInfo info = InstantRunGradleUtils.getBuildInfo(model);
if (info != null && !info.isCompatibleFormat()) {
throw new ExecutionException("This version of Android Studio is incompatible with the Gradle Plugin used. " + "Try disabling Instant Run (or updating either the IDE or the Gradle plugin to " + "the latest version)");
}
}
LaunchTasksProvider launchTasksProvider = myLaunchTasksProviderFactory.get();
if (launchTasksProvider.createsNewProcess()) {
// and the new one).
if (myPreviousSessionProcessHandler != null) {
myPreviousSessionProcessHandler.detachProcess();
}
processHandler = new AndroidProcessHandler(applicationId, launchTasksProvider.monitorRemoteProcess());
console = attachConsole(processHandler, executor);
} else {
assert myPreviousSessionProcessHandler != null : "No process handler from previous session, yet current tasks don't create one";
processHandler = myPreviousSessionProcessHandler;
console = null;
}
LaunchInfo launchInfo = new LaunchInfo(executor, runner, myEnv, myConsoleProvider);
LaunchTaskRunner task = new LaunchTaskRunner(myModule.getProject(), myLaunchConfigName, launchInfo, processHandler, myDeviceFutures, launchTasksProvider);
ProgressManager.getInstance().run(task);
return console == null ? null : new DefaultExecutionResult(console, processHandler);
}
use of com.intellij.execution.DefaultExecutionResult in project intellij-plugins by JetBrains.
the class DartTestRunningState method execute.
@Override
@NotNull
public ExecutionResult execute(@NotNull final Executor executor, @NotNull final ProgramRunner runner) throws ExecutionException {
final ProcessHandler processHandler = startProcess();
final ConsoleView consoleView = createConsole(getEnvironment());
consoleView.attachToProcess(processHandler);
final DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler, createActions(consoleView, processHandler, executor));
if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
DartConsoleProperties properties = (DartConsoleProperties) ((SMTRunnerConsoleView) consoleView).getProperties();
AbstractRerunFailedTestsAction rerunFailedTestsAction = properties.createRerunFailedTestsAction(consoleView);
assert rerunFailedTestsAction != null;
rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
} else {
executionResult.setRestartActions(new ToggleAutoTestAction());
}
return executionResult;
}
use of com.intellij.execution.DefaultExecutionResult in project intellij-plugins by JetBrains.
the class FlexRunner method launchWebFlexUnit.
protected RunContentDescriptor launchWebFlexUnit(final Project project, final RunContentDescriptor contentToReuse, final ExecutionEnvironment env, final FlexUnitRunnerParameters params, final String swfFilePath) throws ExecutionException {
final SwfPolicyFileConnection policyFileConnection = new SwfPolicyFileConnection();
policyFileConnection.open(params.getSocketPolicyPort());
final FlexUnitConnection flexUnitConnection = new FlexUnitConnection();
flexUnitConnection.open(params.getPort());
final ProcessHandler processHandler = new DefaultDebugProcessHandler() {
@Override
protected void destroyProcessImpl() {
flexUnitConnection.write("Finish");
flexUnitConnection.close();
policyFileConnection.close();
super.destroyProcessImpl();
}
@Override
public boolean detachIsDefault() {
return false;
}
};
final ExecutionConsole console = createFlexUnitRunnerConsole(project, env, processHandler);
flexUnitConnection.addListener(new FlexUnitListener(processHandler));
launchWithSelectedApplication(swfFilePath, params.getLauncherParameters());
final RunContentBuilder contentBuilder = new RunContentBuilder(new DefaultExecutionResult(console, processHandler), env);
Disposer.register(project, contentBuilder);
return contentBuilder.showRunContent(contentToReuse);
}
use of com.intellij.execution.DefaultExecutionResult in project Intellij-Plugin by getgauge.
the class GaugeCommandLineState method execute.
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
if (GaugeVersion.isGreaterOrEqual(GaugeRunConfiguration.TEST_RUNNER_SUPPORT_VERSION, false) && GaugeSettingsService.getSettings().useIntelliJTestRunner()) {
ProcessHandler handler = startProcess();
GaugeConsoleProperties properties = new GaugeConsoleProperties(config, "Gauge", executor, handler);
ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("Gauge", handler, properties);
DefaultExecutionResult result = new DefaultExecutionResult(console, handler, createActions(console, handler));
if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(console);
if (action != null) {
action.setModelProvider(((SMTRunnerConsoleView) console)::getResultsViewer);
result.setRestartActions(action);
}
}
return result;
}
return super.execute(executor, runner);
}
use of com.intellij.execution.DefaultExecutionResult in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunningState method execute.
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
ProcessHandler processHandler = startProcess();
TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(myConfiguration.getProject());
setConsoleBuilder(consoleBuilder);
GoTestConsoleProperties consoleProperties = new GoTestConsoleProperties(myConfiguration, executor);
String frameworkName = myConfiguration.getTestFramework().getName();
ConsoleView consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(frameworkName, processHandler, consoleProperties);
consoleView.addMessageFilter(new GoConsoleFilter(myConfiguration.getProject(), myModule, myConfiguration.getWorkingDirectoryUrl()));
ProcessTerminatedListener.attach(processHandler);
DefaultExecutionResult executionResult = new DefaultExecutionResult(consoleView, processHandler);
AbstractRerunFailedTestsAction rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(consoleView);
if (rerunFailedTestsAction != null) {
rerunFailedTestsAction.setModelProvider(((SMTRunnerConsoleView) consoleView)::getResultsViewer);
executionResult.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction());
} else {
executionResult.setRestartActions(new ToggleAutoTestAction());
}
return executionResult;
}
Aggregations