use of com.facebook.buck.intellij.ideabuck.config.BuckModule in project buck by facebook.
the class BuckTestAction method executeOnPooledThread.
@Override
public void executeOnPooledThread(final AnActionEvent e) {
Project project = e.getProject();
BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
String target = buildManager.getCurrentSavedTarget(project);
BuckModule buckModule = project.getComponent(BuckModule.class);
buckModule.attach(target);
if (target == null) {
buildManager.showNoTargetMessage(project);
return;
}
// Initiate a buck test
BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.TEST);
handler.command().addParameter(target);
buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
use of com.facebook.buck.intellij.ideabuck.config.BuckModule in project buck by facebook.
the class BuckUninstallAction method executeOnPooledThread.
@Override
public void executeOnPooledThread(final AnActionEvent e) {
Project project = e.getProject();
BuckBuildManager buildManager = BuckBuildManager.getInstance(project);
String target = buildManager.getCurrentSavedTarget(project);
BuckModule buckModule = project.getComponent(BuckModule.class);
buckModule.attach(target);
if (target == null) {
buildManager.showNoTargetMessage(project);
return;
}
// Initiate a buck uninstall
BuckBuildCommandHandler handler = new BuckBuildCommandHandler(project, project.getBaseDir(), BuckCommand.UNINSTALL);
handler.command().addParameter(target);
buildManager.runBuckCommandWhileConnectedToBuck(handler, ACTION_TITLE, buckModule);
}
use of com.facebook.buck.intellij.ideabuck.config.BuckModule in project buck by facebook.
the class TestExecutionState method runBuildCommand.
private ProcessHandler runBuildCommand(Executor executor) {
final BuckModule buckModule = mProject.getComponent(BuckModule.class);
final String target = mConfiguration.data.target;
final String additionalParams = mConfiguration.data.additionalParams;
final String testSelectors = mConfiguration.data.testSelectors;
final String title = "Buck Test " + target;
buckModule.attach(target);
final BuckBuildCommandHandler handler = new BuckBuildCommandHandler(mProject, mProject.getBaseDir(), BuckCommand.TEST, /* doStartNotify */
false) {
@Override
protected void notifyLines(Key outputType, Iterable<String> lines) {
super.notifyLines(outputType, lines);
if (outputType != ProcessOutputTypes.STDERR) {
return;
}
for (String line : lines) {
final Matcher matcher = DEBUG_SUSPEND_PATTERN.matcher(line);
if (matcher.find()) {
final String port = matcher.group(1);
attachDebugger(title, port);
}
}
}
};
if (!target.isEmpty()) {
handler.command().addParameter(target);
}
if (!testSelectors.isEmpty()) {
handler.command().addParameter("--test-selectors");
handler.command().addParameter(testSelectors);
}
if (!additionalParams.isEmpty()) {
for (String param : additionalParams.split("\\s")) {
handler.command().addParameter(param);
}
}
if (executor.getId().equals(DefaultDebugExecutor.EXECUTOR_ID)) {
handler.command().addParameter("--debug");
}
handler.start();
final OSProcessHandler result = handler.getHandler();
showProgress(result, title);
return result;
}
use of com.facebook.buck.intellij.ideabuck.config.BuckModule 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());
}
}
}
});
}
Aggregations