use of com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo in project intellij by bazelbuild.
the class BlazeConfigurationResolver method update.
public BlazeConfigurationResolverResult update(BlazeContext context, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, BlazeConfigurationResolverResult oldResult) {
ExecutionRootPathResolver executionRootPathResolver = new ExecutionRootPathResolver(Blaze.getBuildSystem(project), WorkspaceRoot.fromProject(project), blazeProjectData.blazeInfo.getExecutionRoot(), blazeProjectData.workspacePathResolver);
ImmutableMap<TargetKey, CToolchainIdeInfo> toolchainLookupMap = BlazeConfigurationToolchainResolver.buildToolchainLookupMap(context, blazeProjectData.targetMap);
ImmutableMap<File, VirtualFile> headerRoots = collectHeaderRoots(context, blazeProjectData, toolchainLookupMap, executionRootPathResolver);
CompilerInfoCache compilerInfoCache = new CompilerInfoCache();
ImmutableMap<CToolchainIdeInfo, BlazeCompilerSettings> compilerSettings = BlazeConfigurationToolchainResolver.buildCompilerSettingsMap(context, project, toolchainLookupMap, executionRootPathResolver, compilerInfoCache, oldResult.compilerSettings);
BlazeConfigurationResolverResult.Builder builder = BlazeConfigurationResolverResult.builder(project);
buildBlazeConfigurationData(context, workspaceRoot, projectViewSet, blazeProjectData, toolchainLookupMap, headerRoots, compilerSettings, compilerInfoCache, executionRootPathResolver, oldResult, builder);
builder.setCompilerSettings(compilerSettings);
return builder.build();
}
use of com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo 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);
});
}
use of com.google.idea.blaze.base.ideinfo.CToolchainIdeInfo in project intellij by bazelbuild.
the class IdeInfoFromProtobuf method makeTargetIdeInfo.
@Nullable
public static TargetIdeInfo makeTargetIdeInfo(IntellijIdeInfo.TargetIdeInfo message) {
Kind kind = getKind(message);
if (kind == null) {
return null;
}
TargetKey key = getKey(message);
ArtifactLocation buildFile = getBuildFile(message);
final Collection<Dependency> dependencies;
if (message.getDepsCount() > 0) {
dependencies = message.getDepsList().stream().map(IdeInfoFromProtobuf::makeDependency).collect(toList());
} else {
dependencies = Lists.newArrayListWithCapacity(message.getDependenciesCount() + message.getRuntimeDepsCount());
dependencies.addAll(makeDependencyListFromLabelList(message.getDependenciesList(), DependencyType.COMPILE_TIME));
dependencies.addAll(makeDependencyListFromLabelList(message.getRuntimeDepsList(), DependencyType.RUNTIME));
}
Collection<String> tags = ImmutableList.copyOf(message.getTagsList());
Collection<ArtifactLocation> sources = Lists.newArrayList();
CIdeInfo cIdeInfo = null;
if (message.hasCIdeInfo()) {
cIdeInfo = makeCIdeInfo(message.getCIdeInfo());
sources.addAll(cIdeInfo.sources);
sources.addAll(cIdeInfo.headers);
sources.addAll(cIdeInfo.textualHeaders);
}
CToolchainIdeInfo cToolchainIdeInfo = null;
if (message.hasCToolchainIdeInfo()) {
cToolchainIdeInfo = makeCToolchainIdeInfo(message.getCToolchainIdeInfo());
}
JavaIdeInfo javaIdeInfo = null;
if (message.hasJavaIdeInfo()) {
javaIdeInfo = makeJavaIdeInfo(message.getJavaIdeInfo());
Collection<ArtifactLocation> javaSources = makeArtifactLocationList(message.getJavaIdeInfo().getSourcesList());
sources.addAll(javaSources);
}
AndroidIdeInfo androidIdeInfo = null;
if (message.hasAndroidIdeInfo()) {
androidIdeInfo = makeAndroidIdeInfo(message.getAndroidIdeInfo());
}
AndroidSdkIdeInfo androidSdkIdeInfo = null;
if (message.hasAndroidSdkIdeInfo()) {
androidSdkIdeInfo = makeAndroidSdkIdeInfo(message.getAndroidSdkIdeInfo());
}
AndroidAarIdeInfo androidAarIdeInfo = null;
if (message.hasAndroidAarIdeInfo()) {
androidAarIdeInfo = makeAndroidAarIdeInfo(message.getAndroidAarIdeInfo());
}
PyIdeInfo pyIdeInfo = null;
if (message.hasPyIdeInfo()) {
pyIdeInfo = makePyIdeInfo(message.getPyIdeInfo());
sources.addAll(pyIdeInfo.sources);
}
GoIdeInfo goIdeInfo = null;
if (message.hasGoIdeInfo()) {
goIdeInfo = makeGoIdeInfo(message.getGoIdeInfo());
sources.addAll(goIdeInfo.sources);
}
JsIdeInfo jsIdeInfo = null;
if (message.hasJsIdeInfo()) {
jsIdeInfo = makeJsIdeInfo(message.getJsIdeInfo());
sources.addAll(jsIdeInfo.sources);
}
TsIdeInfo tsIdeInfo = null;
if (message.hasTsIdeInfo()) {
tsIdeInfo = makeTsIdeInfo(message.getTsIdeInfo());
sources.addAll(tsIdeInfo.sources);
}
DartIdeInfo dartIdeInfo = null;
if (message.hasDartIdeInfo()) {
dartIdeInfo = makeDartIdeInfo(message.getDartIdeInfo());
sources.addAll(dartIdeInfo.sources);
}
TestIdeInfo testIdeInfo = null;
if (message.hasTestInfo()) {
testIdeInfo = makeTestIdeInfo(message.getTestInfo());
}
ProtoLibraryLegacyInfo protoLibraryLegacyInfo = null;
if (message.hasProtoLibraryLegacyJavaIdeInfo()) {
protoLibraryLegacyInfo = makeProtoLibraryLegacyInfo(message.getProtoLibraryLegacyJavaIdeInfo());
}
JavaToolchainIdeInfo javaToolchainIdeInfo = null;
if (message.hasJavaToolchainIdeInfo()) {
javaToolchainIdeInfo = makeJavaToolchainIdeInfo(message.getJavaToolchainIdeInfo());
}
return new TargetIdeInfo(key, kind, buildFile, dependencies, tags, sources, cIdeInfo, cToolchainIdeInfo, javaIdeInfo, androidIdeInfo, androidSdkIdeInfo, androidAarIdeInfo, pyIdeInfo, goIdeInfo, jsIdeInfo, tsIdeInfo, dartIdeInfo, testIdeInfo, protoLibraryLegacyInfo, javaToolchainIdeInfo);
}
Aggregations