Search in sources :

Example 11 with DefaultExecutionResult

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);
}
Also used : InstantRunBuildInfo(com.android.tools.fd.client.InstantRunBuildInfo) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) ConsoleView(com.intellij.execution.ui.ConsoleView) LaunchTasksProvider(com.android.tools.idea.run.tasks.LaunchTasksProvider) AndroidModuleModel(com.android.tools.idea.gradle.project.model.AndroidModuleModel) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionException(com.intellij.execution.ExecutionException) Nullable(org.jetbrains.annotations.Nullable)

Example 12 with DefaultExecutionResult

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;
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Example 13 with DefaultExecutionResult

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);
}
Also used : SwfPolicyFileConnection(com.intellij.lang.javascript.flex.flexunit.SwfPolicyFileConnection) FlexUnitConnection(com.intellij.lang.javascript.flex.flexunit.FlexUnitConnection) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) DefaultDebugProcessHandler(com.intellij.xdebugger.DefaultDebugProcessHandler) DefaultDebugProcessHandler(com.intellij.xdebugger.DefaultDebugProcessHandler) ProcessHandler(com.intellij.execution.process.ProcessHandler) ExecutionConsole(com.intellij.execution.ui.ExecutionConsole) RunContentBuilder(com.intellij.execution.runners.RunContentBuilder)

Example 14 with DefaultExecutionResult

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);
}
Also used : DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) GaugeConsoleProperties(com.thoughtworks.gauge.execution.runner.GaugeConsoleProperties) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) NotNull(org.jetbrains.annotations.NotNull)

Example 15 with DefaultExecutionResult

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;
}
Also used : GoConsoleFilter(com.goide.runconfig.GoConsoleFilter) DefaultExecutionResult(com.intellij.execution.DefaultExecutionResult) TextConsoleBuilder(com.intellij.execution.filters.TextConsoleBuilder) SMTRunnerConsoleView(com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView) ConsoleView(com.intellij.execution.ui.ConsoleView) ProcessHandler(com.intellij.execution.process.ProcessHandler) AbstractRerunFailedTestsAction(com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction) ToggleAutoTestAction(com.intellij.execution.testframework.autotest.ToggleAutoTestAction) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

DefaultExecutionResult (com.intellij.execution.DefaultExecutionResult)19 ProcessHandler (com.intellij.execution.process.ProcessHandler)15 ConsoleView (com.intellij.execution.ui.ConsoleView)10 NotNull (org.jetbrains.annotations.NotNull)9 Nullable (org.jetbrains.annotations.Nullable)6 SMTRunnerConsoleView (com.intellij.execution.testframework.sm.runner.ui.SMTRunnerConsoleView)5 OSProcessHandler (com.intellij.execution.process.OSProcessHandler)4 AbstractRerunFailedTestsAction (com.intellij.execution.testframework.actions.AbstractRerunFailedTestsAction)4 ToggleAutoTestAction (com.intellij.execution.testframework.autotest.ToggleAutoTestAction)4 Executor (com.intellij.execution.Executor)3 ProgramRunner (com.intellij.execution.runners.ProgramRunner)3 BaseTestsOutputConsoleView (com.intellij.execution.testframework.ui.BaseTestsOutputConsoleView)3 ExecutionException (com.intellij.execution.ExecutionException)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)2 RunProfile (com.intellij.execution.configurations.RunProfile)2 ConsoleViewImpl (com.intellij.execution.impl.ConsoleViewImpl)2 TestConsoleProperties (com.intellij.execution.testframework.TestConsoleProperties)2 SMTRunnerConsoleProperties (com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties)2 File (java.io.File)2 InstantRunBuildInfo (com.android.tools.fd.client.InstantRunBuildInfo)1