use of com.google.idea.blaze.base.scope.scopes.TimingScope 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);
}
});
});
}
use of com.google.idea.blaze.base.scope.scopes.TimingScope 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);
});
}
use of com.google.idea.blaze.base.scope.scopes.TimingScope 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);
});
}
use of com.google.idea.blaze.base.scope.scopes.TimingScope in project intellij by bazelbuild.
the class BlazeCSyncPlugin method updateInMemoryState.
@Override
public void updateInMemoryState(Project project, BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, Module workspaceModule) {
if (!blazeProjectData.workspaceLanguageSettings.isLanguageActive(LanguageClass.C)) {
return;
}
Scope.push(context, childContext -> {
childContext.push(new TimingScope("Setup C Workspace", EventType.Other));
OCWorkspace workspace = OCWorkspaceProvider.getWorkspace(project);
if (workspace instanceof BlazeCWorkspace) {
BlazeCWorkspace blazeCWorkspace = (BlazeCWorkspace) workspace;
blazeCWorkspace.update(childContext, workspaceRoot, projectViewSet, blazeProjectData);
}
});
}
use of com.google.idea.blaze.base.scope.scopes.TimingScope in project intellij by bazelbuild.
the class BlazeConfigurationToolchainResolver method buildToolchainLookupMap.
/**
* Returns the toolchain used by each target
*/
static ImmutableMap<TargetKey, CToolchainIdeInfo> buildToolchainLookupMap(BlazeContext context, TargetMap targetMap) {
return Scope.push(context, childContext -> {
childContext.push(new TimingScope("Build toolchain lookup map", EventType.Other));
Map<TargetKey, CToolchainIdeInfo> toolchains = Maps.newLinkedHashMap();
for (TargetIdeInfo target : targetMap.targets()) {
CToolchainIdeInfo cToolchainIdeInfo = target.cToolchainIdeInfo;
if (cToolchainIdeInfo != null) {
toolchains.put(target.key, cToolchainIdeInfo);
}
}
ImmutableMap.Builder<TargetKey, CToolchainIdeInfo> lookupTable = ImmutableMap.builder();
for (TargetIdeInfo target : targetMap.targets()) {
if (target.kind.languageClass != LanguageClass.C || target.kind == Kind.CC_TOOLCHAIN) {
continue;
}
List<TargetKey> toolchainDeps = target.dependencies.stream().map(dep -> dep.targetKey).filter(toolchains::containsKey).collect(Collectors.toList());
if (toolchainDeps.size() != 1) {
issueToolchainWarning(context, target, toolchainDeps);
}
if (!toolchainDeps.isEmpty()) {
TargetKey toolchainKey = toolchainDeps.get(0);
CToolchainIdeInfo toolchainInfo = toolchains.get(toolchainKey);
lookupTable.put(target.key, toolchainInfo);
} else {
CToolchainIdeInfo arbitraryToolchain = Iterables.getFirst(toolchains.values(), null);
if (arbitraryToolchain != null) {
lookupTable.put(target.key, arbitraryToolchain);
}
}
}
return lookupTable.build();
});
}
Aggregations