use of com.google.idea.blaze.base.model.primitives.Kind.Provider 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());
projectFileIndex = mock(ProjectFileIndex.class);
projectServices.register(ProjectFileIndex.class, projectFileIndex);
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());
ExtensionPointImpl<Provider> kindProvider = registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class);
kindProvider.registerExtension(new AndroidBlazeRules());
applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState());
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager(project);
BlazeImportSettings settings = new BlazeImportSettings("", "", "", "", BuildSystemName.Blaze);
importSettingsManager.setImportSettings(settings);
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
projectServices.register(JvmPsiConversionHelper.class, new JvmPsiConversionHelperImpl());
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.model.primitives.Kind.Provider in project intellij by bazelbuild.
the class BlazeAndroidWorkspaceImporterTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
experimentService = new MockExperimentService();
applicationServices.register(ExperimentService.class, experimentService);
BlazeExecutor blazeExecutor = new MockBlazeExecutor();
applicationServices.register(BlazeExecutor.class, blazeExecutor);
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project));
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
MockFileOperationProvider mockFileOperationProvider = new MockFileOperationProvider();
applicationServices.register(FileOperationProvider.class, mockFileOperationProvider);
ExtensionPointImpl<Provider> targetKindEp = registerExtensionPoint(Provider.EP_NAME, Provider.class);
targetKindEp.registerExtension(new AndroidBlazeRules());
targetKindEp.registerExtension(new JavaBlazeRules());
targetKindEp.registerExtension(new GenericBlazeRules());
applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState());
retentionFilterEp = registerExtensionPoint(GeneratedResourceRetentionFilter.EP_NAME, GeneratedResourceRetentionFilter.class);
context = BlazeContext.create();
context.addOutputSink(IssueOutput.class, errorCollector);
registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
registerExtensionPoint(EmptyLibraryFilterSettings.EP_NAME, EmptyLibraryFilterSettings.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());
applicationServices.register(RemoteArtifactPrefetcher.class, new MockRemoteArtifactPrefetcher());
}
use of com.google.idea.blaze.base.model.primitives.Kind.Provider 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());
applicationServices.register(ExperimentService.class, new MockExperimentService());
compilerVersionChecker = new MockCompilerVersionChecker("1234");
applicationServices.register(CompilerVersionChecker.class, compilerVersionChecker);
applicationServices.register(ProgressManager.class, new ProgressManagerImpl());
applicationServices.register(CompilerWrapperProvider.class, new CompilerWrapperProviderImpl());
applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
applicationServices.register(FileOperationProvider.class, new FileOperationProvider());
mockFileSystem = mock(LocalFileSystem.class);
applicationServices.register(VirtualFileSystemProvider.class, mock(VirtualFileSystemProvider.class));
when(VirtualFileSystemProvider.getInstance().getSystem()).thenReturn(mockFileSystem);
ExtensionPointImpl<Provider> ep = registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class);
ep.registerExtension(new CppBlazeRules());
applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState());
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project));
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(new BlazeImportSettings("", "", "", "", getBuildSystemProvider().getBuildSystem().getName()));
registerExtensionPoint(BlazeCompilerFlagsProcessor.EP_NAME, BlazeCompilerFlagsProcessor.Provider.class);
context.addOutputSink(IssueOutput.class, errorCollector);
resolver = new BlazeConfigurationResolver(project);
resolverResult = BlazeConfigurationResolverResult.empty();
}
use of com.google.idea.blaze.base.model.primitives.Kind.Provider in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method initTest.
@Override
protected void initTest(Container applicationServices, Container projectServices) {
super.initTest(applicationServices, projectServices);
applicationServices.register(BlazeExecutor.class, new MockBlazeExecutor());
applicationServices.register(ExperimentService.class, new MockExperimentService());
applicationServices.register(CompilerVersionChecker.class, new MockCompilerVersionChecker("1234"));
applicationServices.register(ProgressManager.class, new ProgressManagerImpl());
applicationServices.register(CompilerWrapperProvider.class, new CompilerWrapperProviderImpl());
applicationServices.register(VirtualFileManager.class, mock(VirtualFileManager.class));
applicationServices.register(FileOperationProvider.class, new FileOperationProvider());
mockFileSystem = mock(LocalFileSystem.class);
applicationServices.register(VirtualFileSystemProvider.class, mock(VirtualFileSystemProvider.class));
when(VirtualFileSystemProvider.getInstance().getSystem()).thenReturn(mockFileSystem);
ExtensionPointImpl<Provider> ep = registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class);
ep.registerExtension(new CppBlazeRules());
applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState());
projectServices.register(PsiManager.class, new MockPsiManager(project));
projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager(project));
BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(new BlazeImportSettings("", "", "", "", getBuildSystemProvider().getBuildSystem().getName()));
registerExtensionPoint(BlazeCompilerFlagsProcessor.EP_NAME, BlazeCompilerFlagsProcessor.Provider.class);
context.addOutputSink(IssueOutput.class, errorCollector);
resolver = new BlazeConfigurationResolver(project);
resolverResult = BlazeConfigurationResolverResult.empty();
}
use of com.google.idea.blaze.base.model.primitives.Kind.Provider in project intellij by bazelbuild.
the class BlazeScalaWorkspaceImporterTest method initTest.
@Override
// False positive on getDeclaredPackageOfJavaFile.
@SuppressWarnings("FunctionalInterfaceClash")
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
super.initTest(applicationServices, projectServices);
context = BlazeContext.create();
context.addOutputSink(IssueOutput.class, errorCollector);
ExtensionPointImpl<Provider> ep = registerExtensionPoint(Kind.Provider.EP_NAME, Kind.Provider.class);
ep.registerExtension(new JavaBlazeRules());
ep.registerExtension(new ScalaBlazeRules());
ep.registerExtension(new GenericBlazeRules());
applicationServices.register(Kind.ApplicationState.class, new Kind.ApplicationState());
registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
registerExtensionPoint(EmptyLibraryFilterSettings.EP_NAME, EmptyLibraryFilterSettings.class);
BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager(project);
importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystemName.Blaze));
projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
applicationServices.register(PrefetchService.class, new MockPrefetchService());
applicationServices.register(PackageManifestReader.class, new PackageManifestReader());
applicationServices.register(ExperimentService.class, new MockExperimentService());
applicationServices.register(FileOperationProvider.class, new FileOperationProvider() {
@Override
public long getFileSize(File file) {
// Make JARs appear nonempty so that they aren't filtered out
return file.getName().endsWith("jar") ? 500L : super.getFileSize(file);
}
});
// will silently fall back to FilePathJavaPackageReader
applicationServices.register(JavaSourcePackageReader.class, new JavaSourcePackageReader() {
@Nullable
@Override
public String getDeclaredPackageOfJavaFile(BlazeContext context, ArtifactLocationDecoder artifactLocationDecoder, SourceArtifact sourceArtifact) {
return null;
}
});
applicationServices.register(RemoteArtifactPrefetcher.class, new MockRemoteArtifactPrefetcher());
ExtensionPoint<JavaLikeLanguage> javaLikeLanguages = registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class);
javaLikeLanguages.registerExtension(new JavaLikeLanguage.Java());
javaLikeLanguages.registerExtension(new ScalaJavaLikeLanguage());
}
Aggregations