use of com.google.idea.blaze.base.sync.projectstructure.ModuleEditorImpl in project intellij by bazelbuild.
the class BlazeSyncTask method updateProjectStructure.
private void updateProjectStructure(BlazeContext context, BlazeImportSettings importSettings, ProjectViewSet projectViewSet, BlazeVersionData blazeVersionData, DirectoryStructure directoryStructure, BlazeProjectData newBlazeProjectData, @Nullable BlazeProjectData oldBlazeProjectData) {
for (BlazeSyncPlugin syncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
syncPlugin.updateProjectSdk(project, context, projectViewSet, blazeVersionData, newBlazeProjectData);
}
ModuleEditorImpl moduleEditor = ModuleEditorProvider.getInstance().getModuleEditor(project, importSettings);
ModuleType workspaceModuleType = null;
for (BlazeSyncPlugin syncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
workspaceModuleType = syncPlugin.getWorkspaceModuleType(newBlazeProjectData.workspaceLanguageSettings.getWorkspaceType());
if (workspaceModuleType != null) {
break;
}
}
if (workspaceModuleType == null) {
workspaceModuleType = ModuleType.EMPTY;
IssueOutput.warn("Could not set module type for workspace module.").submit(context);
}
Module workspaceModule = moduleEditor.createModule(BlazeDataStorage.WORKSPACE_MODULE_NAME, workspaceModuleType);
ModifiableRootModel workspaceModifiableModel = moduleEditor.editModule(workspaceModule);
ContentEntryEditor.createContentEntries(project, workspaceRoot, projectViewSet, newBlazeProjectData, directoryStructure, workspaceModifiableModel);
List<BlazeLibrary> libraries = BlazeLibraryCollector.getLibraries(projectViewSet, newBlazeProjectData);
LibraryEditor.updateProjectLibraries(project, context, projectViewSet, newBlazeProjectData, libraries);
LibraryEditor.configureDependencies(workspaceModifiableModel, libraries);
for (BlazeSyncPlugin blazeSyncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
blazeSyncPlugin.updateProjectStructure(project, context, workspaceRoot, projectViewSet, newBlazeProjectData, oldBlazeProjectData, moduleEditor, workspaceModule, workspaceModifiableModel);
}
createProjectDataDirectoryModule(moduleEditor, new File(importSettings.getProjectDataDirectory()), workspaceModuleType);
moduleEditor.commitWithGc(context);
}
Aggregations