use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class DartCoverageProgramRunner method startCollectingCoverage.
private static void startCollectingCoverage(@NotNull final ExecutionEnvironment env, @NotNull final ProcessHandler dartAppProcessHandler, @NotNull final String observatoryUrl) {
final DartCommandLineRunConfiguration dartRC = (DartCommandLineRunConfiguration) env.getRunProfile();
final DartCoverageEnabledConfiguration coverageConfiguration = (DartCoverageEnabledConfiguration) CoverageEnabledConfiguration.getOrCreate(dartRC);
final String coverageFilePath = coverageConfiguration.getCoverageFilePath();
final DartSdk sdk = DartSdk.getDartSdk(env.getProject());
LOG.assertTrue(sdk != null);
final GeneralCommandLine cmdline = new GeneralCommandLine().withExePath(DartSdkUtil.getPubPath(sdk)).withParameters("global", "run", "coverage:collect_coverage", "--uri", observatoryUrl, "--out", coverageFilePath, "--resume-isolates", "--wait-paused");
try {
final ProcessHandler coverageProcess = new OSProcessHandler(cmdline);
coverageProcess.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(@NotNull final ProcessEvent event, @NotNull final Key outputType) {
LOG.debug(event.getText());
}
});
coverageProcess.startNotify();
coverageConfiguration.setCoverageProcess(coverageProcess);
CoverageHelper.attachToProcess(dartRC, dartAppProcessHandler, env.getRunnerSettings());
} catch (ExecutionException e) {
LOG.error(e);
}
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class DartCoverageProgramRunner method activateCoverage.
private boolean activateCoverage(@NotNull final Project project, @NotNull final String dartPubPath) {
ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> {
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
if (indicator != null) {
indicator.setIndeterminate(true);
}
try {
// 'pub global list' is fast, let's run it first to find out if coverage package is already activated.
// Following 'pub global activate' is long and may be cancelled by user
checkIfCoverageActivated(dartPubPath);
// run 'pub global activate' regardless of activation status, because it checks for the coverage package update
final ProcessOutput activateOutput = new CapturingProcessHandler(new GeneralCommandLine().withExePath(dartPubPath).withParameters("global", "activate", "coverage").withRedirectErrorStream(true)).runProcessWithProgressIndicator(ProgressManager.getInstance().getProgressIndicator());
if (activateOutput.getExitCode() != 0) {
LOG.warn("'pub global activate coverage' exit code: " + activateOutput.getExitCode() + ", stdout:\n" + activateOutput.getStdout());
}
if (!myCoveragePackageActivated) {
checkIfCoverageActivated(dartPubPath);
}
} catch (ExecutionException e) {
LOG.warn(e);
}
}, "Activating Coverage Package...", true, project);
// Even if 'pub global activate' process has been cancelled we can proceed if coverage already activated
return myCoveragePackageActivated;
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class Reveal method refreshRevealPreOnePointSix.
private static void refreshRevealPreOnePointSix(@NotNull String bundleID, @Nullable String deviceName) throws ExecutionException {
// Pre Reveal 1.6, the refresh script was not bundled with the application
String script = "activate\n" + "repeat with doc in documents\n" + " refresh doc " + " application bundle identifier \"" + StringUtil.escapeQuotes(bundleID) + "\"";
if (deviceName != null) {
script += " device name \"" + StringUtil.escapeQuotes(deviceName) + "\"";
}
script += " when available\n" + "end repeat\n" + "activate\n";
try {
AppleScript.tell("Reveal", script, true);
} catch (IdeScriptException e) {
LOG.info("Reveal script failed:\n" + script);
throw new ExecutionException("Cannot refresh Reveal: " + e.getMessage(), e);
}
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class RevealRunConfigurationExtension method signAndInstall.
@NotNull
private static File signAndInstall(@NotNull File libReveal, @NotNull final BuildConfiguration buildConfiguration, @NotNull File mainExecutable) throws ExecutionException {
File frameworksDir = new File(mainExecutable.getParent(), "Frameworks");
File libRevealCopy = new File(frameworksDir, libReveal.getName());
try {
FileUtil.copy(libReveal, libRevealCopy);
} catch (IOException e) {
throw new ExecutionException("Cannot create a temporary copy of Reveal library", e);
}
AppCodeInstaller.codesignBinary(buildConfiguration, mainExecutable, frameworksDir.getAbsolutePath(), libRevealCopy.getName());
return new File("Frameworks", libRevealCopy.getName());
}
use of com.intellij.execution.ExecutionException in project intellij-plugins by JetBrains.
the class RevealRunConfigurationExtension method getBundleID.
@NotNull
private static String getBundleID(@NotNull ExecutionEnvironment environment, @NotNull File product) throws ExecutionException {
String result = environment.getUserData(BUNDLE_ID_KEY);
if (result != null)
return result;
File plistFile = new File(product, "Info.plist");
Plist plist = PlistDriver.readAnyFormatSafe(plistFile);
if (plist == null)
throw new ExecutionException("Info.plist not found at " + plistFile);
result = plist.getString("CFBundleIdentifier");
if (result == null)
throw new ExecutionException("CFBundleIdentifier not found in " + plistFile);
environment.putUserData(BUNDLE_ID_KEY, result);
return result;
}
Aggregations