use of com.google.idea.blaze.base.run.processhandler.ScopedBlazeProcessHandler in project intellij by bazelbuild.
the class BlazeCidrLauncher method createProcess.
@Override
public ProcessHandler createProcess(CommandLineState state) throws ExecutionException {
ImmutableList<String> testHandlerFlags = ImmutableList.of();
BlazeTestUiSession testUiSession = useTestUi() ? TestUiSessionProvider.getInstance(project).getTestUiSession(configuration.getTarget()) : null;
if (testUiSession != null) {
testHandlerFlags = testUiSession.getBlazeFlags();
}
ProjectViewSet projectViewSet = Preconditions.checkNotNull(ProjectViewManager.getInstance(project).getProjectViewSet());
List<String> fixedBlazeFlags = getFixedBlazeFlags();
BlazeCommand.Builder command = BlazeCommand.builder(Blaze.getBuildSystemProvider(project).getBinaryPath(), handlerState.getCommandState().getCommand()).addTargets(configuration.getTarget()).addBlazeFlags(BlazeFlags.blazeFlags(project, projectViewSet, handlerState.getCommandState().getCommand(), BlazeInvocationContext.NonSync)).addBlazeFlags(testHandlerFlags).addBlazeFlags(fixedBlazeFlags).addExeFlags(handlerState.getExeFlagsState().getExpandedFlags());
state.setConsoleBuilder(createConsoleBuilder(testUiSession));
state.addConsoleFilters(getConsoleFilters().toArray(new Filter[0]));
WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
return new ScopedBlazeProcessHandler(project, command.build(), workspaceRoot, new ScopedBlazeProcessHandler.ScopedProcessHandlerDelegate() {
@Override
public void onBlazeContextStart(BlazeContext context) {
context.push(new IssuesScope(project, BlazeUserSettings.getInstance().getShowProblemsViewForRunAction()));
}
@Override
public ImmutableList<ProcessListener> createProcessListeners(BlazeContext context) {
LineProcessingOutputStream outputStream = LineProcessingOutputStream.of(BlazeConsoleLineProcessorProvider.getAllStderrLineProcessors(context));
return ImmutableList.of(new LineProcessingProcessAdapter(outputStream));
}
});
}
use of com.google.idea.blaze.base.run.processhandler.ScopedBlazeProcessHandler in project intellij by bazelbuild.
the class BlazeJavaRunProfileState method startProcess.
@Override
protected ProcessHandler startProcess() throws ExecutionException {
Project project = configuration.getProject();
BlazeCommand.Builder blazeCommand;
BlazeTestUiSession testUiSession = useTestUi() ? TestUiSessionProvider.getInstance(project).getTestUiSession(configuration.getTarget()) : null;
if (testUiSession != null) {
blazeCommand = getBlazeCommandBuilder(project, configuration, testUiSession.getBlazeFlags(), executorType);
setConsoleBuilder(new TextConsoleBuilderImpl(project) {
@Override
protected ConsoleView createConsole() {
return SmRunnerUtils.getConsoleView(project, configuration, getEnvironment().getExecutor(), testUiSession);
}
});
} else {
blazeCommand = getBlazeCommandBuilder(project, configuration, ImmutableList.of(), executorType);
}
addConsoleFilters(new BlazeTargetFilter(project, true), new IssueOutputFilter(project, WorkspaceRoot.fromProject(project), BlazeInvocationContext.NonSync, false));
List<String> command = HotSwapUtils.canHotSwap(getEnvironment()) ? getBashCommandsToRunScript(blazeCommand) : blazeCommand.build().toList();
WorkspaceRoot workspaceRoot = WorkspaceRoot.fromProject(project);
return new ScopedBlazeProcessHandler(project, command, workspaceRoot, new ScopedBlazeProcessHandler.ScopedProcessHandlerDelegate() {
@Override
public void onBlazeContextStart(BlazeContext context) {
context.push(new IssuesScope(project, BlazeUserSettings.getInstance().getShowProblemsViewForRunAction())).push(new IdeaLogScope());
}
@Override
public ImmutableList<ProcessListener> createProcessListeners(BlazeContext context) {
LineProcessingOutputStream outputStream = LineProcessingOutputStream.of(BlazeConsoleLineProcessorProvider.getAllStderrLineProcessors(context));
return ImmutableList.of(new LineProcessingProcessAdapter(outputStream));
}
});
}
Aggregations