use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.
the class ProjectViewManagerImpl method reloadProjectView.
@Nullable
@Override
public ProjectViewSet reloadProjectView(BlazeContext context, WorkspacePathResolver workspacePathResolver) {
BlazeImportSettings importSettings = BlazeImportSettingsManager.getInstance(project).getImportSettings();
assert importSettings != null;
assert importSettings.getProjectViewFile() != null;
File projectViewFile = new File(importSettings.getProjectViewFile());
ProjectViewParser parser = new ProjectViewParser(context, workspacePathResolver);
parser.parseProjectView(projectViewFile);
boolean success = !context.hasErrors();
if (success) {
ProjectViewSet projectViewSet = parser.getResult();
File file = getCacheFile(project, importSettings);
try {
SerializationUtil.saveToDisk(file, projectViewSet);
} catch (IOException e) {
logger.error(e);
}
this.projectViewSet = projectViewSet;
}
return success ? projectViewSet : null;
}
use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.
the class BlazeBuildServiceTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", Blaze.BuildSystem.Blaze));
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
applicationServices.register(ExperimentService.class, new MockExperimentService());
ProjectView view = ProjectView.builder().add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//view/target:one")).add(TargetExpression.fromStringSafe("//view/target:two"))).build();
viewSet = ProjectViewSet.builder().add(new File("view/target/.blazeproject"), view).build();
ProjectViewManager viewManager = new MockProjectViewManager(viewSet);
projectServices.register(ProjectViewManager.class, viewManager);
BlazeProjectData blazeProjectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).build();
projectServices.register(BlazeProjectDataManager.class, new MockBlazeProjectDataManager(blazeProjectData));
applicationServices.register(BlazeBuildService.class, spy(new BlazeBuildService()));
service = BlazeBuildService.getInstance();
assertThat(service).isNotNull();
// Can't mock BlazeExecutor.submitTask.
doNothing().when(service).buildTargetExpressions(any(), any(), any(), any());
}
use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.
the class BlazeRenderErrorContributorTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(FileTypeManager.class, new MockFileTypeManager());
projectServices.register(ProjectFileIndex.class, mock(ProjectFileIndex.class));
projectServices.register(BuildReferenceManager.class, new MockBuildReferenceManager(project));
projectServices.register(TransitiveDependencyMap.class, new TransitiveDependencyMap(project));
projectServices.register(ProjectScopeBuilder.class, new ProjectScopeBuilderImpl(project));
projectServices.register(AndroidResourceModuleRegistry.class, new AndroidResourceModuleRegistry());
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
BlazeImportSettings settings = new BlazeImportSettings("", "", "", "", BuildSystem.Blaze);
importSettingsManager.setImportSettings(settings);
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
createPsiClassesAndSourceToTargetMap(projectServices);
projectDataManager = new MockBlazeProjectDataManager();
projectServices.register(BlazeProjectDataManager.class, projectDataManager);
ExtensionPoint<RenderErrorContributor.Provider> extensionPoint = registerExtensionPoint(ExtensionPointName.create("com.android.rendering.renderErrorContributor"), RenderErrorContributor.Provider.class);
extensionPoint.registerExtension(new RenderErrorContributor.Provider());
extensionPoint.registerExtension(new BlazeRenderErrorContributor.BlazeProvider());
module = new MockModule(project, () -> {
});
// For the isApplicable tests.
provider = new BlazeRenderErrorContributor.BlazeProvider();
}
use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.
the class CPrefetchFileSourceTest method getImportRoots.
private ImportRoots getImportRoots(ProjectViewSet projectViewSet) {
BlazeImportSettings importSettings = BlazeImportSettingsManager.getInstance(getProject()).getImportSettings();
WorkspaceRoot workspaceRoot = WorkspaceRoot.fromImportSettings(importSettings);
return ImportRoots.builder(workspaceRoot, importSettings.getBuildSystem()).add(projectViewSet).build();
}
use of com.google.idea.blaze.base.settings.BlazeImportSettings in project intellij by bazelbuild.
the class BlazeConfigurationResolverTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(BlazeExecutor.class, new MockBlazeExecutor());
CPPEnvironmentAdapter.registerForTest(applicationServices.getPicoContainer());
applicationServices.register(ExperimentService.class, new MockExperimentService());
compilerVersionChecker = new MockCompilerVersionChecker("1234");
applicationServices.register(CompilerVersionChecker.class, compilerVersionChecker);
applicationServices.register(ProgressManager.class, new ProgressManagerImpl());
applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
mockFileSystem = mock(LocalFileSystem.class);
applicationServices.register(VirtualFileSystemProvider.class, mock(VirtualFileSystemProvider.class));
when(VirtualFileSystemProvider.getInstance().getSystem()).thenReturn(mockFileSystem);
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
BuildSystemProvider buildSystemProvider = new BazelBuildSystemProvider();
registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class).registerExtension(buildSystemProvider);
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(new BlazeImportSettings("", "", "", "", buildSystemProvider.buildSystem()));
context.addOutputSink(IssueOutput.class, errorCollector);
resolver = new BlazeConfigurationResolver(project);
resolverResult = BlazeConfigurationResolverResult.empty(project);
}
Aggregations