use of com.google.idea.blaze.base.scope.ScopedOperation in project intellij by bazelbuild.
the class BlazeConfigurationResolver method buildBlazeConfigurationData.
private void buildBlazeConfigurationData(BlazeContext parentContext, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, ImmutableMap<TargetKey, CToolchainIdeInfo> toolchainLookupMap, ImmutableMap<File, VirtualFile> headerRoots, ImmutableMap<CToolchainIdeInfo, BlazeCompilerSettings> compilerSettings, CompilerInfoCache compilerInfoCache, ExecutionRootPathResolver executionRootPathResolver, BlazeConfigurationResolverResult oldConfigurationData, BlazeConfigurationResolverResult.Builder builder) {
// Type specification needed to avoid incorrect type inference during command line build.
Scope.push(parentContext, (ScopedOperation) context -> {
context.push(new TimingScope("Build C configuration map", EventType.Other));
ProjectViewTargetImportFilter filter = new ProjectViewTargetImportFilter(project, workspaceRoot, projectViewSet);
ConcurrentMap<TargetKey, BlazeResolveConfigurationData> targetToData = Maps.newConcurrentMap();
List<ListenableFuture<?>> targetToDataFutures = blazeProjectData.targetMap.targets().stream().filter(target -> target.kind.languageClass == LanguageClass.C).filter(target -> target.kind != Kind.CC_TOOLCHAIN).filter(filter::isSourceTarget).filter(BlazeConfigurationResolver::containsCompiledSources).map(target -> submit(() -> {
BlazeResolveConfigurationData data = createResolveConfiguration(target, toolchainLookupMap, headerRoots, compilerSettings, compilerInfoCache, executionRootPathResolver);
if (data != null) {
targetToData.put(target.key, data);
}
return null;
})).collect(Collectors.toList());
try {
Futures.allAsList(targetToDataFutures).get();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
context.setCancelled();
return;
} catch (ExecutionException e) {
IssueOutput.error("Could not build C resolve configurations: " + e).submit(context);
logger.error("Could not build C resolve configurations", e);
return;
}
findEquivalenceClasses(context, project, blazeProjectData.workspacePathResolver, targetToData, oldConfigurationData, builder);
});
}
Aggregations