use of com.google.idea.blaze.base.settings.BlazeImportSettingsManager 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.BlazeImportSettingsManager in project intellij by bazelbuild.
the class BlazeCommandRunConfigurationCommonStateTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(UISettings.class, new UISettings());
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
state = new BlazeCommandRunConfigurationCommonState(Blaze.getBuildSystem(project));
}
use of com.google.idea.blaze.base.settings.BlazeImportSettingsManager in project intellij by bazelbuild.
the class BlazeJavaRunProfileStateTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
ExperimentService experimentService = new MockExperimentService();
applicationServices.register(ExperimentService.class, experimentService);
applicationServices.register(BlazeUserSettings.class, new BlazeUserSettings());
projectServices.register(FastBuildService.class, new DisabledFastBuildService());
projectServices.register(ProjectViewManager.class, new MockProjectViewManager());
ExtensionPointImpl<TargetFinder> targetFinderEp = registerExtensionPoint(TargetFinder.EP_NAME, TargetFinder.class);
targetFinderEp.registerExtension(new MockTargetFinder());
ExtensionPointImpl<JavaLikeLanguage> javaLikeEp = registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class);
javaLikeEp.registerExtension(new JavaLikeLanguage.Java());
registerExtensionPoint(BuildFlagsProvider.EP_NAME, BuildFlagsProvider.class);
ExtensionPointImpl<BlazeCommandRunConfigurationHandlerProvider> handlerProviderEp = registerExtensionPoint(BlazeCommandRunConfigurationHandlerProvider.EP_NAME, BlazeCommandRunConfigurationHandlerProvider.class);
handlerProviderEp.registerExtension(new BlazeJavaRunConfigurationHandlerProvider());
handlerProviderEp.registerExtension(new BlazeCommandGenericRunConfigurationHandlerProvider());
ExtensionPointImpl<BuildSystemProvider> buildSystemProviderExtensionPoint = registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class);
BuildSystemProvider buildSystemProvider = mock(BuildSystemProvider.class);
when(buildSystemProvider.getBinaryPath()).thenReturn("/usr/bin/blaze");
buildSystemProviderExtensionPoint.registerExtension(buildSystemProvider);
configuration = new BlazeCommandRunConfigurationType().getFactory().createTemplateConfiguration(project);
}
use of com.google.idea.blaze.base.settings.BlazeImportSettingsManager 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.BlazeImportSettingsManager in project intellij by bazelbuild.
the class BlazeAndroidWorkspaceImporterTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
MockExperimentService mockExperimentService = new MockExperimentService();
applicationServices.register(ExperimentService.class, mockExperimentService);
BlazeExecutor blazeExecutor = new MockBlazeExecutor();
applicationServices.register(BlazeExecutor.class, blazeExecutor);
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
MockFileOperationProvider mockFileOperationProvider = new MockFileOperationProvider();
applicationServices.register(FileOperationProvider.class, mockFileOperationProvider);
context = new BlazeContext();
context.addOutputSink(IssueOutput.class, errorCollector);
registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
// For importJavaWorkspace.
applicationServices.register(JavaSourcePackageReader.class, new JavaSourcePackageReader() {
@Nullable
@Override
public String getDeclaredPackageOfJavaFile(BlazeContext context, ArtifactLocationDecoder artifactLocationDecoder, SourceArtifact sourceArtifact) {
return null;
}
});
applicationServices.register(PackageManifestReader.class, new PackageManifestReader());
applicationServices.register(PrefetchService.class, new MockPrefetchService());
registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class).registerExtension(new JavaLikeLanguage.Java());
}
Aggregations