Search in sources :

Example 1 with PackageManifestReader

use of com.google.idea.blaze.java.sync.source.PackageManifestReader 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());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) PackageManifestReader(com.google.idea.blaze.java.sync.source.PackageManifestReader) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) SourceArtifact(com.google.idea.blaze.java.sync.source.SourceArtifact) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) BlazeExecutor(com.google.idea.blaze.base.async.executor.BlazeExecutor) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) JavaSourcePackageReader(com.google.idea.blaze.java.sync.source.JavaSourcePackageReader) Nullable(javax.annotation.Nullable)

Example 2 with PackageManifestReader

use of com.google.idea.blaze.java.sync.source.PackageManifestReader in project intellij by bazelbuild.

the class BlazeJavaWorkspaceImporterTest method initTest.

@Override
// False positive on getDeclaredPackageOfJavaFile.
@SuppressWarnings("FunctionalInterfaceClash")
protected void initTest(Container applicationServices, Container projectServices) {
    applicationServices.register(ExperimentService.class, new MockExperimentService());
    BlazeExecutor blazeExecutor = new MockBlazeExecutor();
    applicationServices.register(BlazeExecutor.class, blazeExecutor);
    projectServices.register(BlazeImportSettingsManager.class, new BlazeImportSettingsManager());
    BlazeImportSettingsManager.getInstance(getProject()).setImportSettings(DUMMY_IMPORT_SETTINGS);
    // 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(PackageManifestReader.class, new PackageManifestReader());
    applicationServices.register(PrefetchService.class, new MockPrefetchService());
    context = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
    augmenters = registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
    registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class).registerExtension(new JavaLikeLanguage.Java());
}
Also used : MockExperimentService(com.google.idea.common.experiments.MockExperimentService) BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) PackageManifestReader(com.google.idea.blaze.java.sync.source.PackageManifestReader) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) SourceArtifact(com.google.idea.blaze.java.sync.source.SourceArtifact) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) BlazeJavaSyncAugmenter(com.google.idea.blaze.java.sync.BlazeJavaSyncAugmenter) MockBlazeExecutor(com.google.idea.blaze.base.async.executor.MockBlazeExecutor) BlazeExecutor(com.google.idea.blaze.base.async.executor.BlazeExecutor) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) JavaSourcePackageReader(com.google.idea.blaze.java.sync.source.JavaSourcePackageReader) Nullable(javax.annotation.Nullable)

Example 3 with PackageManifestReader

use of com.google.idea.blaze.java.sync.source.PackageManifestReader 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 = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
    registerExtensionPoint(BlazeJavaSyncAugmenter.EP_NAME, BlazeJavaSyncAugmenter.class);
    BlazeImportSettingsManager importSettingsManager = new BlazeImportSettingsManager();
    importSettingsManager.setImportSettings(new BlazeImportSettings("", "", "", "", BuildSystem.Blaze));
    projectServices.register(BlazeImportSettingsManager.class, importSettingsManager);
    applicationServices.register(PrefetchService.class, new MockPrefetchService());
    applicationServices.register(PackageManifestReader.class, new PackageManifestReader());
    // 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;
        }
    });
    ExtensionPoint<JavaLikeLanguage> javaLikeLanguages = registerExtensionPoint(JavaLikeLanguage.EP_NAME, JavaLikeLanguage.class);
    javaLikeLanguages.registerExtension(new JavaLikeLanguage.Java());
    javaLikeLanguages.registerExtension(new ScalaJavaLikeLanguage());
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) BlazeImportSettings(com.google.idea.blaze.base.settings.BlazeImportSettings) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) ScalaJavaLikeLanguage(com.google.idea.blaze.scala.sync.source.ScalaJavaLikeLanguage) PackageManifestReader(com.google.idea.blaze.java.sync.source.PackageManifestReader) ScalaJavaLikeLanguage(com.google.idea.blaze.scala.sync.source.ScalaJavaLikeLanguage) SourceArtifact(com.google.idea.blaze.java.sync.source.SourceArtifact) BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) MockPrefetchService(com.google.idea.blaze.base.prefetch.MockPrefetchService) ArtifactLocationDecoder(com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder) JavaSourcePackageReader(com.google.idea.blaze.java.sync.source.JavaSourcePackageReader) Nullable(javax.annotation.Nullable)

Aggregations

MockPrefetchService (com.google.idea.blaze.base.prefetch.MockPrefetchService)3 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)3 BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)3 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)3 JavaLikeLanguage (com.google.idea.blaze.java.sync.source.JavaLikeLanguage)3 JavaSourcePackageReader (com.google.idea.blaze.java.sync.source.JavaSourcePackageReader)3 PackageManifestReader (com.google.idea.blaze.java.sync.source.PackageManifestReader)3 SourceArtifact (com.google.idea.blaze.java.sync.source.SourceArtifact)3 Nullable (javax.annotation.Nullable)3 BlazeExecutor (com.google.idea.blaze.base.async.executor.BlazeExecutor)2 MockBlazeExecutor (com.google.idea.blaze.base.async.executor.MockBlazeExecutor)2 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)2 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)1 BlazeJavaSyncAugmenter (com.google.idea.blaze.java.sync.BlazeJavaSyncAugmenter)1 ScalaJavaLikeLanguage (com.google.idea.blaze.scala.sync.source.ScalaJavaLikeLanguage)1