Search in sources :

Example 1 with BlazeTargetFilter

use of com.google.idea.blaze.base.run.filter.BlazeTargetFilter 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));
        }
    });
}
Also used : IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) LineProcessingProcessAdapter(com.google.idea.blaze.base.run.processhandler.LineProcessingProcessAdapter) BlazeCommand(com.google.idea.blaze.base.command.BlazeCommand) ConsoleView(com.intellij.execution.ui.ConsoleView) ImmutableList(com.google.common.collect.ImmutableList) BlazeTargetFilter(com.google.idea.blaze.base.run.filter.BlazeTargetFilter) WorkspaceRoot(com.google.idea.blaze.base.model.primitives.WorkspaceRoot) ScopedBlazeProcessHandler(com.google.idea.blaze.base.run.processhandler.ScopedBlazeProcessHandler) Project(com.intellij.openapi.project.Project) IdeaLogScope(com.google.idea.blaze.base.scope.scopes.IdeaLogScope) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) IssuesScope(com.google.idea.blaze.base.scope.scopes.IssuesScope) LineProcessingOutputStream(com.google.idea.blaze.base.async.process.LineProcessingOutputStream) BlazeTestUiSession(com.google.idea.blaze.base.run.smrunner.BlazeTestUiSession) TextConsoleBuilderImpl(com.intellij.execution.filters.TextConsoleBuilderImpl)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 LineProcessingOutputStream (com.google.idea.blaze.base.async.process.LineProcessingOutputStream)1 BlazeCommand (com.google.idea.blaze.base.command.BlazeCommand)1 IssueOutputFilter (com.google.idea.blaze.base.issueparser.IssueOutputFilter)1 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)1 BlazeTargetFilter (com.google.idea.blaze.base.run.filter.BlazeTargetFilter)1 LineProcessingProcessAdapter (com.google.idea.blaze.base.run.processhandler.LineProcessingProcessAdapter)1 ScopedBlazeProcessHandler (com.google.idea.blaze.base.run.processhandler.ScopedBlazeProcessHandler)1 BlazeTestUiSession (com.google.idea.blaze.base.run.smrunner.BlazeTestUiSession)1 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)1 IdeaLogScope (com.google.idea.blaze.base.scope.scopes.IdeaLogScope)1 IssuesScope (com.google.idea.blaze.base.scope.scopes.IssuesScope)1 TextConsoleBuilderImpl (com.intellij.execution.filters.TextConsoleBuilderImpl)1 ConsoleView (com.intellij.execution.ui.ConsoleView)1 Project (com.intellij.openapi.project.Project)1