use of com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator in project intellij by bazelbuild.
the class BlazeJavaWorkspaceImporter method importWorkspace.
public BlazeJavaImportResult importWorkspace(BlazeContext context) {
WorkspaceBuilder workspaceBuilder = new WorkspaceBuilder();
for (TargetIdeInfo target : sourceFilter.sourceTargets) {
addTargetAsSource(workspaceBuilder, target, sourceFilter.targetToJavaSources.get(target.getKey()));
}
SourceDirectoryCalculator sourceDirectoryCalculator = new SourceDirectoryCalculator();
ImmutableList<BlazeContentEntry> contentEntries = sourceDirectoryCalculator.calculateContentEntries(project, context, workspaceRoot, artifactLocationDecoder, importRoots, workspaceBuilder.sourceArtifacts, workspaceBuilder.javaPackageManifests);
int totalContentEntryCount = 0;
for (BlazeContentEntry contentEntry : contentEntries) {
totalContentEntryCount += contentEntry.sources.size();
}
context.output(PrintOutput.log("Java content entry count: " + totalContentEntryCount));
BlazeJavaImportResult.Builder importResultBuilder = BlazeJavaImportResult.builder();
ImmutableMap<LibraryKey, BlazeJarLibrary> libraries = buildLibraries(context, workspaceBuilder, sourceFilter.libraryTargets, importResultBuilder);
duplicateSourceDetector.reportDuplicates(context);
String sourceVersion = findSourceVersion(targetMap);
return importResultBuilder.setContentEntries(contentEntries).setLibraries(libraries).setBuildOutputJars(ImmutableList.sortedCopyOf(workspaceBuilder.buildOutputJars)).setJavaSourceFiles(ImmutableSet.copyOf(workspaceBuilder.addedSourceFiles)).setSourceVersion(sourceVersion).setPluginProcessorJars(workspaceBuilder.pluginProcessorJars).build();
}
Aggregations