Search in sources :

Example 1 with SharedStringPoolScope

use of com.google.idea.blaze.base.scope.scopes.SharedStringPoolScope in project intellij by bazelbuild.

the class CommandLineBlazeCommandRunner method run.

@Override
public BlazeBuildOutputs run(Project project, BlazeCommand.Builder blazeCommandBuilder, BuildResultHelper buildResultHelper, WorkspaceRoot workspaceRoot, BlazeContext context) {
    int retVal = ExternalTask.builder(workspaceRoot).addBlazeCommand(blazeCommandBuilder.build()).context(context).stderr(LineProcessingOutputStream.of(BlazeConsoleLineProcessorProvider.getAllStderrLineProcessors(context))).build().run();
    BuildResult buildResult = BuildResult.fromExitCode(retVal);
    if (buildResult.status == Status.FATAL_ERROR) {
        return BlazeBuildOutputs.noOutputs(buildResult);
    }
    try {
        context.output(PrintOutput.log("Build command finished. Retrieving BEP outputs..."));
        Interner<String> stringInterner = Optional.ofNullable(context.getScope(SharedStringPoolScope.class)).map(SharedStringPoolScope::getStringInterner).orElse(null);
        return BlazeBuildOutputs.fromParsedBepOutput(buildResult, buildResultHelper.getBuildOutput(stringInterner));
    } catch (GetArtifactsException e) {
        IssueOutput.error("Failed to get build outputs: " + e.getMessage()).submit(context);
        return BlazeBuildOutputs.noOutputs(buildResult);
    }
}
Also used : BuildResult(com.google.idea.blaze.base.sync.aspects.BuildResult) GetArtifactsException(com.google.idea.blaze.base.command.buildresult.BuildResultHelper.GetArtifactsException) SharedStringPoolScope(com.google.idea.blaze.base.scope.scopes.SharedStringPoolScope)

Example 2 with SharedStringPoolScope

use of com.google.idea.blaze.base.scope.scopes.SharedStringPoolScope in project intellij by bazelbuild.

the class SyncPhaseCoordinator method setupScopes.

/**
 * Sets up the root {@link BlazeContext} for the given {@link SyncPhase}.
 */
private void setupScopes(BlazeSyncParams syncParams, BlazeContext context, ProgressIndicator indicator, SyncPhase phase, Task task) {
    boolean clearProblems = phase != SyncPhase.PROJECT_UPDATE;
    boolean notifyFinished = phase != SyncPhase.BUILD;
    context.push(new ExperimentScope());
    if (BlazeUserSettings.getInstance().getShowPerformanceWarnings()) {
        context.push(new PerformanceWarningScope());
    }
    context.push(new ProgressIndicatorScope(indicator));
    context.push(new NetworkTrafficTrackingScope());
    context.push(new SharedStringPoolScope());
    BlazeUserSettings userSettings = BlazeUserSettings.getInstance();
    context.push(new ToolWindowScope.Builder(project, task).setProgressIndicator(indicator).setPopupBehavior(syncParams.backgroundSync() ? FocusBehavior.NEVER : userSettings.getShowBlazeConsoleOnSync()).setIssueParsers(BlazeIssueParser.defaultIssueParsers(project, WorkspaceRoot.fromProject(project), ContextType.Sync)).build()).push(new BlazeConsoleScope.Builder(project, indicator).setPopupBehavior(syncParams.backgroundSync() ? FocusBehavior.NEVER : userSettings.getShowBlazeConsoleOnSync()).addConsoleFilters(new IssueOutputFilter(project, WorkspaceRoot.fromProject(project), ContextType.Sync, true)).setClearPreviousState(clearProblems).build()).push(new ProblemsViewScope(project, syncParams.backgroundSync() ? FocusBehavior.NEVER : userSettings.getShowProblemsViewOnSync(), /* resetProblemsContext= */
    clearProblems)).push(new IdeaLogScope());
    if (notifyFinished && !syncParams.backgroundSync() && syncParams.syncMode() != SyncMode.NO_BUILD) {
        context.push(new NotificationScope(project, "Sync", "Sync project", "Sync successful", "Sync failed"));
    }
    context.output(new StatusOutput(String.format("Syncing project: %s...", syncParams)));
}
Also used : IssueOutputFilter(com.google.idea.blaze.base.issueparser.IssueOutputFilter) ExperimentScope(com.google.idea.blaze.base.experiments.ExperimentScope) NetworkTrafficTrackingScope(com.google.idea.blaze.base.scope.scopes.NetworkTrafficTrackingScope) SharedStringPoolScope(com.google.idea.blaze.base.scope.scopes.SharedStringPoolScope) NotificationScope(com.google.idea.blaze.base.scope.scopes.NotificationScope) StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput) PerformanceWarningScope(com.google.idea.blaze.base.scope.scopes.PerformanceWarningScope) IdeaLogScope(com.google.idea.blaze.base.scope.scopes.IdeaLogScope) BlazeConsoleScope(com.google.idea.blaze.base.scope.scopes.BlazeConsoleScope) BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings) ProblemsViewScope(com.google.idea.blaze.base.scope.scopes.ProblemsViewScope) ProgressIndicatorScope(com.google.idea.blaze.base.scope.scopes.ProgressIndicatorScope)

Aggregations

SharedStringPoolScope (com.google.idea.blaze.base.scope.scopes.SharedStringPoolScope)2 GetArtifactsException (com.google.idea.blaze.base.command.buildresult.BuildResultHelper.GetArtifactsException)1 ExperimentScope (com.google.idea.blaze.base.experiments.ExperimentScope)1 IssueOutputFilter (com.google.idea.blaze.base.issueparser.IssueOutputFilter)1 StatusOutput (com.google.idea.blaze.base.scope.output.StatusOutput)1 BlazeConsoleScope (com.google.idea.blaze.base.scope.scopes.BlazeConsoleScope)1 IdeaLogScope (com.google.idea.blaze.base.scope.scopes.IdeaLogScope)1 NetworkTrafficTrackingScope (com.google.idea.blaze.base.scope.scopes.NetworkTrafficTrackingScope)1 NotificationScope (com.google.idea.blaze.base.scope.scopes.NotificationScope)1 PerformanceWarningScope (com.google.idea.blaze.base.scope.scopes.PerformanceWarningScope)1 ProblemsViewScope (com.google.idea.blaze.base.scope.scopes.ProblemsViewScope)1 ProgressIndicatorScope (com.google.idea.blaze.base.scope.scopes.ProgressIndicatorScope)1 BlazeUserSettings (com.google.idea.blaze.base.settings.BlazeUserSettings)1 BuildResult (com.google.idea.blaze.base.sync.aspects.BuildResult)1