Search in sources :

Example 1 with DartCommandLineRunningState

use of com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunningState in project intellij-plugins by JetBrains.

the class DartCoverageProgramRunner method doExecute.

@Nullable
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
    FileDocumentManager.getInstance().saveAllDocuments();
    final DartCommandLineRunConfiguration runConfiguration = (DartCommandLineRunConfiguration) env.getRunProfile();
    final DartSdk sdk = DartSdk.getDartSdk(runConfiguration.getProject());
    if (sdk == null) {
        throw new ExecutionException(DartBundle.message("dart.sdk.is.not.configured"));
    }
    final String dartPubPath = DartSdkUtil.getPubPath(sdk);
    final RunContentDescriptor result = DefaultProgramRunnerKt.executeState(state, env, this);
    if (result == null) {
        return null;
    }
    if (!myCoveragePackageActivated && !activateCoverage(runConfiguration.getProject(), dartPubPath)) {
        throw new ExecutionException("Cannot activate pub package 'coverage'.");
    }
    final ProcessHandler dartAppProcessHandler = result.getProcessHandler();
    if (dartAppProcessHandler != null) {
        ((DartCommandLineRunningState) state).addObservatoryUrlConsumer(observatoryUrl -> startCollectingCoverage(env, dartAppProcessHandler, observatoryUrl));
    }
    return result;
}
Also used : DartCommandLineRunningState(com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunningState) DartSdk(com.jetbrains.lang.dart.sdk.DartSdk) RunContentDescriptor(com.intellij.execution.ui.RunContentDescriptor) DartCommandLineRunConfiguration(com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunConfiguration) ExecutionException(com.intellij.execution.ExecutionException) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

ExecutionException (com.intellij.execution.ExecutionException)1 RunContentDescriptor (com.intellij.execution.ui.RunContentDescriptor)1 DartCommandLineRunConfiguration (com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunConfiguration)1 DartCommandLineRunningState (com.jetbrains.lang.dart.ide.runner.server.DartCommandLineRunningState)1 DartSdk (com.jetbrains.lang.dart.sdk.DartSdk)1 Nullable (org.jetbrains.annotations.Nullable)1