Search in sources :

Example 1 with JavaLikeLanguage

use of com.google.idea.blaze.java.sync.source.JavaLikeLanguage 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);
}
Also used : BlazeImportSettingsManager(com.google.idea.blaze.base.settings.BlazeImportSettingsManager) MockExperimentService(com.google.idea.common.experiments.MockExperimentService) JavaLikeLanguage(com.google.idea.blaze.java.sync.source.JavaLikeLanguage) BlazeCommandRunConfigurationHandlerProvider(com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider) BuildSystemProvider(com.google.idea.blaze.base.bazel.BuildSystemProvider) BlazeCommandGenericRunConfigurationHandlerProvider(com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationHandlerProvider) TargetFinder(com.google.idea.blaze.base.run.targetfinder.TargetFinder) BlazeCommandRunConfigurationType(com.google.idea.blaze.base.run.BlazeCommandRunConfigurationType) BlazeUserSettings(com.google.idea.blaze.base.settings.BlazeUserSettings) ExperimentService(com.google.idea.common.experiments.ExperimentService) MockExperimentService(com.google.idea.common.experiments.MockExperimentService)

Example 2 with JavaLikeLanguage

use of com.google.idea.blaze.java.sync.source.JavaLikeLanguage 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

BlazeImportSettingsManager (com.google.idea.blaze.base.settings.BlazeImportSettingsManager)2 JavaLikeLanguage (com.google.idea.blaze.java.sync.source.JavaLikeLanguage)2 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)1 MockPrefetchService (com.google.idea.blaze.base.prefetch.MockPrefetchService)1 BlazeCommandRunConfigurationType (com.google.idea.blaze.base.run.BlazeCommandRunConfigurationType)1 BlazeCommandGenericRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandGenericRunConfigurationHandlerProvider)1 BlazeCommandRunConfigurationHandlerProvider (com.google.idea.blaze.base.run.confighandler.BlazeCommandRunConfigurationHandlerProvider)1 TargetFinder (com.google.idea.blaze.base.run.targetfinder.TargetFinder)1 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)1 BlazeImportSettings (com.google.idea.blaze.base.settings.BlazeImportSettings)1 BlazeUserSettings (com.google.idea.blaze.base.settings.BlazeUserSettings)1 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)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 ScalaJavaLikeLanguage (com.google.idea.blaze.scala.sync.source.ScalaJavaLikeLanguage)1 ExperimentService (com.google.idea.common.experiments.ExperimentService)1 MockExperimentService (com.google.idea.common.experiments.MockExperimentService)1 Nullable (javax.annotation.Nullable)1