use of com.google.idea.blaze.base.sync.SourceFolderProvider in project intellij by bazelbuild.
the class ContentEntryEditor method createContentEntries.
public static void createContentEntries(Project project, WorkspaceRoot workspaceRoot, ProjectViewSet projectViewSet, BlazeProjectData blazeProjectData, DirectoryStructure rootDirectoryStructure, ModifiableRootModel modifiableRootModel) {
ImportRoots importRoots = ImportRoots.builder(workspaceRoot, Blaze.getBuildSystem(project)).add(projectViewSet).build();
Collection<WorkspacePath> rootDirectories = importRoots.rootDirectories();
Collection<WorkspacePath> excludeDirectories = importRoots.excludeDirectories();
Multimap<WorkspacePath, WorkspacePath> excludesByRootDirectory = sortExcludesByRootDirectory(rootDirectories, excludeDirectories);
SourceTestConfig testConfig = new SourceTestConfig(projectViewSet);
SourceFolderProvider provider = SourceFolderProvider.getSourceFolderProvider(blazeProjectData);
for (WorkspacePath rootDirectory : rootDirectories) {
File rootFile = workspaceRoot.fileForPath(rootDirectory);
ContentEntry contentEntry = modifiableRootModel.addContentEntry(UrlUtil.pathToUrl(rootFile.getPath()));
for (WorkspacePath exclude : excludesByRootDirectory.get(rootDirectory)) {
File excludeFolder = workspaceRoot.fileForPath(exclude);
contentEntry.addExcludeFolder(UrlUtil.fileToIdeaUrl(excludeFolder));
}
ImmutableMap<File, SourceFolder> sourceFolders = provider.initializeSourceFolders(contentEntry);
SourceFolder rootSource = sourceFolders.get(rootFile);
walkFileSystem(workspaceRoot, testConfig, excludesByRootDirectory.get(rootDirectory), contentEntry, provider, sourceFolders, rootSource, rootDirectory, rootDirectoryStructure.directories.get(rootDirectory));
}
}
Aggregations