Search in sources :

Example 1 with ScalaBlazeRules

use of com.google.idea.blaze.scala.ScalaBlazeRules 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());
}
Also used : JavaBlazeRules(com.google.idea.blaze.java.JavaBlazeRules) MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) ScalaBlazeRules(com.google.idea.blaze.scala.ScalaBlazeRules) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) Kind(com.google.idea.blaze.base.model.primitives.Kind) FileOperationProvider(com.google.idea.blaze.base.io.FileOperationProvider) MockArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) JavaSourcePackageReader(com.google.idea.blaze.java.sync.source.JavaSourcePackageReader) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) ScalaJavaLikeLanguage(com.google.idea.blaze.scala.ScalaJavaLikeLanguage) PackageManifestReader(com.google.idea.blaze.java.sync.source.PackageManifestReader) GenericBlazeRules(com.google.idea.blaze.base.model.primitives.GenericBlazeRules) ScalaJavaLikeLanguage(com.google.idea.blaze.scala.ScalaJavaLikeLanguage) MockRemoteArtifactPrefetcher(com.google.idea.blaze.base.sync.MockRemoteArtifactPrefetcher) SourceArtifact(com.google.idea.blaze.java.sync.source.SourceArtifact) FileOperationProvider(com.google.idea.blaze.base.io.FileOperationProvider) Provider(com.google.idea.blaze.base.model.primitives.Kind.Provider) File(java.io.File) Nullable(javax.annotation.Nullable)

Aggregations

FileOperationProvider (com.google.idea.blaze.base.io.FileOperationProvider)1 GenericBlazeRules (com.google.idea.blaze.base.model.primitives.GenericBlazeRules)1 Kind (com.google.idea.blaze.base.model.primitives.Kind)1 Provider (com.google.idea.blaze.base.model.primitives.Kind.Provider)1 MockPrefetchService (com.google.idea.blaze.base.prefetch.MockPrefetchService)1 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)1 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)1 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)1 MockRemoteArtifactPrefetcher (com.google.idea.blaze.base.sync.MockRemoteArtifactPrefetcher)1 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)1 MockArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.MockArtifactLocationDecoder)1 JavaBlazeRules (com.google.idea.blaze.java.JavaBlazeRules)1 JavaLikeLanguage (com.google.idea.blaze.java.sync.source.JavaLikeLanguage)1 JavaSourcePackageReader (com.google.idea.blaze.java.sync.source.JavaSourcePackageReader)1 PackageManifestReader (com.google.idea.blaze.java.sync.source.PackageManifestReader)1 SourceArtifact (com.google.idea.blaze.java.sync.source.SourceArtifact)1 ScalaBlazeRules (com.google.idea.blaze.scala.ScalaBlazeRules)1 ScalaJavaLikeLanguage (com.google.idea.blaze.scala.ScalaJavaLikeLanguage)1 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)1 File (java.io.File)1