use of com.intellij.execution.ExecutionException in project buck by facebook.
the class BuckClient method connect.
public void connect() {
if (isConnected() || mConnecting.get()) {
return;
}
mConnecting.set(true);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
int port = BuckWSServerPortUtils.getPort(mProject.getBasePath());
// Connect to WebServer
connectToWebServer("localhost", port);
} catch (NumberFormatException e) {
LOG.error(e);
} catch (ExecutionException e) {
LOG.error(e);
} catch (IOException e) {
LOG.error(e);
} catch (RuntimeException e) {
if (!mProject.isDisposed()) {
BuckModule buckModule = mProject.getComponent(BuckModule.class);
buckModule.attachIfDetached();
buckModule.getBuckEventsConsumer().consumeConsoleEvent(e.toString());
}
}
}
});
}
use of com.intellij.execution.ExecutionException in project jscs-plugin by idok.
the class JscsSettingsPage method getVersion.
private void getVersion() {
if (settings != null && areEqual(nodeInterpreterField, settings.node) && areEqual(jscsBinField, settings.jscsExecutablePath) && settings.cwd.equals(project.getBasePath())) {
return;
}
settings = new JscsSettings();
settings.node = nodeInterpreterField.getChildComponent().getText();
settings.jscsExecutablePath = jscsBinField.getChildComponent().getText();
settings.cwd = project.getBasePath();
try {
String version = JscsRunner.version(settings);
versionLabel.setText(version.trim());
} catch (ExecutionException e) {
e.printStackTrace();
}
}
use of com.intellij.execution.ExecutionException in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoTestRunningState method patchExecutor.
@Override
protected GoExecutor patchExecutor(@NotNull GoExecutor executor) throws ExecutionException {
executor.withParameters("test", "-v");
executor.withParameterString(myConfiguration.getGoToolParams());
switch(myConfiguration.getKind()) {
case DIRECTORY:
String relativePath = FileUtil.getRelativePath(myConfiguration.getWorkingDirectory(), myConfiguration.getDirectoryPath(), File.separatorChar);
// TODO Once Go gets support for covering multiple packages the ternary condition should be reverted
// See https://golang.org/issues/6909
String pathSuffix = myCoverageFilePath == null ? "..." : ".";
if (relativePath != null && !".".equals(relativePath)) {
executor.withParameters("./" + relativePath + "/" + pathSuffix);
} else {
executor.withParameters("./" + pathSuffix);
executor.withWorkDirectory(myConfiguration.getDirectoryPath());
}
addFilterParameter(executor, ObjectUtils.notNull(myFailedTestsPattern, myConfiguration.getPattern()));
break;
case PACKAGE:
executor.withParameters(myConfiguration.getPackage());
addFilterParameter(executor, ObjectUtils.notNull(myFailedTestsPattern, myConfiguration.getPattern()));
break;
case FILE:
String filePath = myConfiguration.getFilePath();
VirtualFile virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath);
if (virtualFile == null) {
throw new ExecutionException("Test file doesn't exist");
}
PsiFile file = PsiManager.getInstance(myConfiguration.getProject()).findFile(virtualFile);
if (file == null || !GoTestFinder.isTestFile(file)) {
throw new ExecutionException("File '" + filePath + "' is not test file");
}
String importPath = ((GoFile) file).getImportPath(false);
if (StringUtil.isEmpty(importPath)) {
throw new ExecutionException("Cannot find import path for " + filePath);
}
executor.withParameters(importPath);
addFilterParameter(executor, myFailedTestsPattern != null ? myFailedTestsPattern : buildFilterPatternForFile((GoFile) file));
break;
}
if (myCoverageFilePath != null) {
executor.withParameters("-coverprofile=" + myCoverageFilePath, "-covermode=atomic");
}
return executor;
}
use of com.intellij.execution.ExecutionException in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoRunConfigurationBase method createRunningState.
@NotNull
private RunningState createRunningState(ExecutionEnvironment env) throws ExecutionException {
GoModuleBasedConfiguration configuration = getConfigurationModule();
Module module = configuration.getModule();
if (module == null) {
throw new ExecutionException("Go isn't configured for run configuration: " + getName());
}
return newRunningState(env, module);
}
use of com.intellij.execution.ExecutionException in project go-lang-idea-plugin by go-lang-plugin-org.
the class GoExecutor method createCommandLine.
@NotNull
public GeneralCommandLine createCommandLine() throws ExecutionException {
if (myGoRoot == null) {
throw new ExecutionException("Sdk is not set or Sdk home path is empty for module");
}
GeneralCommandLine commandLine = !myPtyDisabled && PtyCommandLine.isEnabled() ? new PtyCommandLine() : new GeneralCommandLine();
commandLine.setExePath(ObjectUtils.notNull(myExePath, GoSdkService.getGoExecutablePath(myGoRoot)));
commandLine.getEnvironment().putAll(myExtraEnvironment);
commandLine.getEnvironment().put(GoConstants.GO_ROOT, StringUtil.notNullize(myGoRoot));
commandLine.getEnvironment().put(GoConstants.GO_PATH, StringUtil.notNullize(myGoPath));
if (myVendoringEnabled != null) {
commandLine.getEnvironment().put(GoConstants.GO_VENDORING_EXPERIMENT, myVendoringEnabled ? "1" : "0");
}
Collection<String> paths = ContainerUtil.newArrayList();
ContainerUtil.addIfNotNull(paths, StringUtil.nullize(commandLine.getEnvironment().get(GoConstants.PATH), true));
ContainerUtil.addIfNotNull(paths, StringUtil.nullize(EnvironmentUtil.getValue(GoConstants.PATH), true));
ContainerUtil.addIfNotNull(paths, StringUtil.nullize(myEnvPath, true));
commandLine.getEnvironment().put(GoConstants.PATH, StringUtil.join(paths, File.pathSeparator));
commandLine.withWorkDirectory(myWorkDirectory);
commandLine.addParameters(myParameterList.getList());
commandLine.withParentEnvironmentType(myParentEnvironmentType);
commandLine.withCharset(CharsetToolkit.UTF8_CHARSET);
return commandLine;
}
Aggregations