Search in sources :

Example 26 with TimingScope

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

the class BlazeIdeInterfaceAspectsImpl method doResolveIdeArtifacts.

/**
 * Blaze build invocation requesting the 'intellij-resolve' aspect output group.
 *
 * <p>Prefetches the output artifacts built by this invocation.
 */
private static BuildResult doResolveIdeArtifacts(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeVersionData blazeVersionData, WorkspaceLanguageSettings workspaceLanguageSettings, List<TargetExpression> targets) {
    try (BuildResultHelper buildResultHelper = BuildResultHelper.forFiles(getGenfilePrefetchFilter())) {
        BlazeCommand.Builder blazeCommandBuilder = BlazeCommand.builder(getBinaryPath(project), BlazeCommandName.BUILD).addTargets(targets).addBlazeFlags(BlazeFlags.KEEP_GOING).addBlazeFlags(buildResultHelper.getBuildFlags()).addBlazeFlags(BlazeFlags.blazeFlags(project, projectViewSet, BlazeCommandName.BUILD, BlazeInvocationContext.Sync));
        // Request the 'intellij-resolve' aspect output group.
        AspectStrategyProvider.findAspectStrategy(blazeVersionData).addAspectAndOutputGroups(blazeCommandBuilder, OutputGroup.RESOLVE, workspaceLanguageSettings.activeLanguages);
        // Run the blaze build command, parsing any output artifacts produced.
        int retVal = ExternalTask.builder(workspaceRoot).addBlazeCommand(blazeCommandBuilder.build()).context(context).stderr(LineProcessingOutputStream.of(BlazeConsoleLineProcessorProvider.getAllStderrLineProcessors(context))).build().run(new TimingScope("ExecuteBlazeCommand", EventType.BlazeInvocation));
        BuildResult result = BuildResult.fromExitCode(retVal);
        if (result.status != BuildResult.Status.FATAL_ERROR) {
            prefetchGenfiles(project, context, buildResultHelper.getBuildArtifacts());
        } else {
            buildResultHelper.close();
        }
        return result;
    }
}
Also used : BuildResultHelper(com.google.idea.blaze.base.command.buildresult.BuildResultHelper) TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope) BlazeCommand(com.google.idea.blaze.base.command.BlazeCommand)

Example 27 with TimingScope

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

the class WildcardTargetExpander method expandToSingleTargets.

/**
 * Runs a sharded blaze query to expand wildcard targets to individual blaze targets
 */
static ExpandedTargetsResult expandToSingleTargets(Project project, BlazeContext parentContext, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, List<TargetExpression> allTargets) {
    return Scope.push(parentContext, context -> {
        context.push(new TimingScope("ExpandTargetsQuery", EventType.BlazeInvocation));
        context.setPropagatesErrors(false);
        return doExpandToSingleTargets(project, context, workspaceRoot, projectViewSet, allTargets);
    });
}
Also used : TimingScope(com.google.idea.blaze.base.scope.scopes.TimingScope)

Aggregations

TimingScope (com.google.idea.blaze.base.scope.scopes.TimingScope)27 StatusOutput (com.google.idea.blaze.base.scope.output.StatusOutput)8 TargetKey (com.google.idea.blaze.base.ideinfo.TargetKey)7 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)7 Nullable (javax.annotation.Nullable)7 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)6 EventType (com.google.idea.blaze.base.scope.scopes.TimingScope.EventType)6 Logger (com.intellij.openapi.diagnostic.Logger)6 List (java.util.List)6 ImmutableList (com.google.common.collect.ImmutableList)5 ImmutableMap (com.google.common.collect.ImmutableMap)5 Lists (com.google.common.collect.Lists)5 Maps (com.google.common.collect.Maps)5 Futures (com.google.common.util.concurrent.Futures)5 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)5 TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)5 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)5 Scope (com.google.idea.blaze.base.scope.Scope)5 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)5 Project (com.intellij.openapi.project.Project)5