Search in sources :

Example 6 with BlazeSyncPlugin

use of com.google.idea.blaze.base.sync.BlazeSyncPlugin in project intellij by bazelbuild.

the class BlazeKotlinSyncPluginTest method initTest.

@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
    super.initTest(applicationServices, projectServices);
    ExtensionPointImpl<BuildSystemProvider> buildSystems = registerExtensionPoint(BuildSystemProvider.EP_NAME, BuildSystemProvider.class);
    buildSystems.registerExtension(new BazelBuildSystemProvider());
    ExtensionPointImpl<BlazeSyncPlugin> syncPlugins = registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
    syncPlugins.registerExtension(new BlazeJavaSyncPlugin());
    syncPlugins.registerExtension(new BlazeKotlinSyncPlugin());
    context = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
}
Also used : BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) BlazeJavaSyncPlugin(com.google.idea.blaze.java.sync.BlazeJavaSyncPlugin) BlazeSyncPlugin(com.google.idea.blaze.base.sync.BlazeSyncPlugin) BazelBuildSystemProvider(com.google.idea.blaze.base.bazel.BazelBuildSystemProvider) BuildSystemProvider(com.google.idea.blaze.base.bazel.BuildSystemProvider) BazelBuildSystemProvider(com.google.idea.blaze.base.bazel.BazelBuildSystemProvider)

Example 7 with BlazeSyncPlugin

use of com.google.idea.blaze.base.sync.BlazeSyncPlugin in project intellij by bazelbuild.

the class BlazeScalaSyncPluginTest method initTest.

@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
    super.initTest(applicationServices, projectServices);
    ExtensionPointImpl<BlazeSyncPlugin> syncPlugins = registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
    syncPlugins.registerExtension(new BlazeJavaSyncPlugin());
    syncPlugins.registerExtension(new BlazeScalaSyncPlugin());
    context = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
}
Also used : BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) BlazeJavaSyncPlugin(com.google.idea.blaze.java.sync.BlazeJavaSyncPlugin) BlazeSyncPlugin(com.google.idea.blaze.base.sync.BlazeSyncPlugin)

Example 8 with BlazeSyncPlugin

use of com.google.idea.blaze.base.sync.BlazeSyncPlugin in project intellij by bazelbuild.

the class LanguageSupport method supportedLanguagesForWorkspaceType.

/**
 * @return The set of {@link LanguageClass}'s supported for this {@link WorkspaceType}s.
 */
public static Set<LanguageClass> supportedLanguagesForWorkspaceType(WorkspaceType type) {
    Set<LanguageClass> supportedLanguages = EnumSet.noneOf(LanguageClass.class);
    for (BlazeSyncPlugin syncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
        supportedLanguages.addAll(syncPlugin.getSupportedLanguagesInWorkspace(type));
        supportedLanguages.addAll(syncPlugin.getAlwaysActiveLanguages());
    }
    supportedLanguages.add(LanguageClass.GENERIC);
    return supportedLanguages;
}
Also used : BlazeSyncPlugin(com.google.idea.blaze.base.sync.BlazeSyncPlugin) LanguageClass(com.google.idea.blaze.base.model.primitives.LanguageClass)

Example 9 with BlazeSyncPlugin

use of com.google.idea.blaze.base.sync.BlazeSyncPlugin in project intellij by bazelbuild.

the class LanguageSupport method getDefaultWorkspaceType.

public static WorkspaceType getDefaultWorkspaceType() {
    WorkspaceType workspaceType = null;
    // prioritize by enum ordinal.
    for (BlazeSyncPlugin syncPlugin : BlazeSyncPlugin.EP_NAME.getExtensions()) {
        WorkspaceType recommendedType = syncPlugin.getDefaultWorkspaceType();
        if (recommendedType != null && (workspaceType == null || workspaceType.ordinal() > recommendedType.ordinal())) {
            workspaceType = recommendedType;
        }
    }
    // Should never happen, outside of tests without proper set up.
    checkState(workspaceType != null, "No SyncPlugin present which provides a default workspace type.");
    return workspaceType;
}
Also used : WorkspaceType(com.google.idea.blaze.base.model.primitives.WorkspaceType) BlazeSyncPlugin(com.google.idea.blaze.base.sync.BlazeSyncPlugin)

Example 10 with BlazeSyncPlugin

use of com.google.idea.blaze.base.sync.BlazeSyncPlugin in project intellij by bazelbuild.

the class BlazeGoSyncPluginTest method initTest.

@Override
protected void initTest(@NotNull Container applicationServices, @NotNull Container projectServices) {
    super.initTest(applicationServices, projectServices);
    syncPluginEp = registerExtensionPoint(BlazeSyncPlugin.EP_NAME, BlazeSyncPlugin.class);
    syncPluginEp.registerExtension(new BlazeGoSyncPlugin());
    syncPluginEp.registerExtension(new AlwaysPresentGoSyncPlugin());
    // At least one sync plugin providing a default workspace type must be present
    syncPluginEp.registerExtension(new BlazeSyncPlugin() {

        @Override
        public ImmutableList<WorkspaceType> getSupportedWorkspaceTypes() {
            return ImmutableList.of(WorkspaceType.JAVA);
        }

        @Override
        public Set<LanguageClass> getSupportedLanguagesInWorkspace(WorkspaceType workspaceType) {
            return ImmutableSet.of(LanguageClass.JAVA);
        }

        @Nullable
        @Override
        public WorkspaceType getDefaultWorkspaceType() {
            return WorkspaceType.JAVA;
        }
    });
    context = new BlazeContext();
    context.addOutputSink(IssueOutput.class, errorCollector);
}
Also used : BlazeContext(com.google.idea.blaze.base.scope.BlazeContext) WorkspaceType(com.google.idea.blaze.base.model.primitives.WorkspaceType) ImmutableSet(com.google.common.collect.ImmutableSet) Set(java.util.Set) ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) ImmutableList(com.google.common.collect.ImmutableList) BlazeSyncPlugin(com.google.idea.blaze.base.sync.BlazeSyncPlugin) Nullable(javax.annotation.Nullable)

Aggregations

BlazeSyncPlugin (com.google.idea.blaze.base.sync.BlazeSyncPlugin)13 BlazeContext (com.google.idea.blaze.base.scope.BlazeContext)9 WorkspaceType (com.google.idea.blaze.base.model.primitives.WorkspaceType)7 Set (java.util.Set)6 ImmutableList (com.google.common.collect.ImmutableList)5 ImmutableSet (com.google.common.collect.ImmutableSet)5 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)5 BlazeLibrary (com.google.idea.blaze.base.model.BlazeLibrary)2 BlazeJavaSyncPlugin (com.google.idea.blaze.java.sync.BlazeJavaSyncPlugin)2 Objects (java.util.Objects)2 Nullable (javax.annotation.Nullable)2 Lists (com.google.common.collect.Lists)1 Sets (com.google.common.collect.Sets)1 BazelBuildSystemProvider (com.google.idea.blaze.base.bazel.BazelBuildSystemProvider)1 BuildSystemProvider (com.google.idea.blaze.base.bazel.BuildSystemProvider)1 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)1 LibraryKey (com.google.idea.blaze.base.model.LibraryKey)1 LanguageClass (com.google.idea.blaze.base.model.primitives.LanguageClass)1 PrintOutput (com.google.idea.blaze.base.scope.output.PrintOutput)1 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)1