Search in sources :

Example 6 with StatusOutput

use of com.google.idea.blaze.base.scope.output.StatusOutput in project intellij by bazelbuild.

the class BlazeSyncTask method updateInMemoryState.

private void updateInMemoryState(Project project, BlazeContext parentContext, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData) {
    Scope.push(parentContext, context -> {
        context.push(new TimingScope("UpdateInMemoryState", EventType.Other));
        context.output(new StatusOutput("Updating in-memory state..."));
        ApplicationManager.getApplication().runReadAction(() -> {
            Module workspaceModule = ModuleFinder.getInstance(project).findModuleByName(BlazeDataStorage.WORKSPACE_MODULE_NAME);
            for (BlazeSyncPlugin blazeSyncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
                blazeSyncPlugin.updateInMemoryState(project, context, workspaceRoot, projectViewSet, blazeProjectData, workspaceModule);
            }
        });
    });
}
Also used : TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput) Module(com.intellij.openapi.module.Module)

Example 7 with StatusOutput

use of com.google.idea.blaze.base.scope.output.StatusOutput in project intellij by bazelbuild.

the class BlazeSyncTask method getIdeQueryResult.

private BlazeIdeInterface.IdeResult getIdeQueryResult(Project project, BlazeContext parentContext, ProjectViewSet projectViewSet, BlazeVersionData blazeVersionData, BlazeConfigurationHandler configHandler, ShardedTargetList shardedTargets, WorkspaceLanguageSettings workspaceLanguageSettings, ArtifactLocationDecoder artifactLocationDecoder, Builder syncStateBuilder, @Nullable SyncState previousSyncState, boolean mergeWithOldState) {
    return Scope.push(parentContext, context -> {
        context.push(new TimingScope("IdeQuery", EventType.BlazeInvocation));
        context.output(new StatusOutput("Building IDE info files..."));
        context.setPropagatesErrors(false);
        BlazeIdeInterface blazeIdeInterface = BlazeIdeInterface.getInstance();
        return blazeIdeInterface.updateTargetMap(project, context, workspaceRoot, projectViewSet, blazeVersionData, configHandler, shardedTargets, workspaceLanguageSettings, artifactLocationDecoder, syncStateBuilder, previousSyncState, mergeWithOldState);
    });
}
Also used : TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput) BlazeIdeInterface(com.google.idea.blaze.base.sync.aspects.BlazeIdeInterface)

Example 8 with StatusOutput

use of com.google.idea.blaze.base.scope.output.StatusOutput in project intellij by bazelbuild.

the class BlazeBuildTargetSharder method expandWildcardTargets.

/**
 * Expand wildcard target patterns into individual blaze targets.
 */
private static ExpandedTargetsResult expandWildcardTargets(Project project, BlazeContext parentContext, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, WorkspacePathResolver pathResolver, List<TargetExpression> targets) {
    return Scope.push(parentContext, context -> {
        context.push(new TimingScope("ShardSyncTargets", EventType.Other));
        context.output(new StatusOutput("Sharding: expanding wildcard target patterns..."));
        context.setPropagatesErrors(false);
        return doExpandWildcardTargets(project, context, workspaceRoot, projectViewSet, pathResolver, targets);
    });
}
Also used : TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput)

Example 9 with StatusOutput

use of com.google.idea.blaze.base.scope.output.StatusOutput in project intellij by bazelbuild.

the class NotificationScope method onScopeEnd.

@Override
public void onScopeEnd(@NotNull BlazeContext context) {
    if (project.isDisposed()) {
        return;
    }
    if (context.isCancelled()) {
        context.output(new StatusOutput(notificationName + " cancelled"));
        return;
    }
    long duration = System.currentTimeMillis() - startTime;
    if (duration < NOTIFICATION_THRESHOLD_MS) {
        return;
    }
    String notificationText = !context.hasErrors() ? this.notificationText : this.notificationErrorText;
    SystemNotifications.getInstance().notify(notificationName, notificationTitle, notificationText);
    if (context.hasErrors()) {
        context.output(PrintOutput.error(notificationName + " failed"));
    }
}
Also used : StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput)

Example 10 with StatusOutput

use of com.google.idea.blaze.base.scope.output.StatusOutput in project intellij by bazelbuild.

the class BlazeAndroidSyncPlugin method installSdks.

@Override
public void installSdks(BlazeContext context) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return;
    }
    File path = IdeSdks.getInstance().getAndroidSdkPath();
    if (path != null) {
        context.output(new StatusOutput("Installing SDK platforms..."));
        ApplicationManager.getApplication().invokeAndWait(() -> {
            IdeSdks.getInstance().createAndroidSdkPerAndroidTarget(path);
        }, ModalityState.defaultModalityState());
    }
}
Also used : StatusOutput(com.google.idea.blaze.base.scope.output.StatusOutput) File(java.io.File)

Aggregations

StatusOutput (com.google.idea.blaze.base.scope.output.StatusOutput)16 TimingScope (com.google.idea.blaze.base.scope.scopes.TimingScope)8 IssueOutputFilter (com.google.idea.blaze.base.issueparser.IssueOutputFilter)3 Label (com.google.idea.blaze.base.model.primitives.Label)3 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)3 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)3 BlazeConsoleScope (com.google.idea.blaze.base.scope.scopes.BlazeConsoleScope)3 IssuesScope (com.google.idea.blaze.base.scope.scopes.IssuesScope)3 BuildResult (com.google.idea.blaze.base.sync.aspects.BuildResult)3 Kind (com.google.idea.blaze.base.model.primitives.Kind)2 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)2 BlazeConsolePopupBehavior (com.google.idea.blaze.base.settings.BlazeUserSettings.BlazeConsolePopupBehavior)2 BlazeIdeInterface (com.google.idea.blaze.base.sync.aspects.BlazeIdeInterface)2 Function (com.google.common.base.Function)1 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 Futures (com.google.common.util.concurrent.Futures)1