Search in sources :

Example 1 with SourceDirectoryCalculator

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();
}
Also used : TargetIdeInfo(com.google.idea.blaze.base.ideinfo.TargetIdeInfo) BlazeContentEntry(com.google.idea.blaze.java.sync.model.BlazeContentEntry) BlazeJavaImportResult(com.google.idea.blaze.java.sync.model.BlazeJavaImportResult) BlazeJarLibrary(com.google.idea.blaze.java.sync.model.BlazeJarLibrary) LibraryKey(com.google.idea.blaze.base.model.LibraryKey) SourceDirectoryCalculator(com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator)

Aggregations

TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)1 LibraryKey (com.google.idea.blaze.base.model.LibraryKey)1 BlazeContentEntry (com.google.idea.blaze.java.sync.model.BlazeContentEntry)1 BlazeJarLibrary (com.google.idea.blaze.java.sync.model.BlazeJarLibrary)1 BlazeJavaImportResult (com.google.idea.blaze.java.sync.model.BlazeJavaImportResult)1 SourceDirectoryCalculator (com.google.idea.blaze.java.sync.source.SourceDirectoryCalculator)1