use of com.facebook.buck.intellij.ideabuck.build.BuckBuildCommandHandler 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;
}
Aggregations