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;
}
Aggregations