Search in sources :

Example 1 with DefaultProjectResolverContext

use of org.jetbrains.plugins.gradle.service.project.DefaultProjectResolverContext in project android by JetBrains.

the class AndroidGradleProjectResolverIdeaTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    initMocks(this);
    myProjectModel = new IdeaProjectStub("multiProject");
    myAndroidProject = TestProjects.createBasicProject(myProjectModel.getRootDir());
    myNativeAndroidProject = TestProjects.createNativeProject(myProjectModel.getRootDir());
    myAndroidModuleModel = myProjectModel.addModule(myAndroidProject.getName(), "androidTask");
    myNativeAndroidModuleModel = myProjectModel.addModule(myNativeAndroidProject.getName(), "nativeAndroidTask");
    myJavaModuleModel = myProjectModel.addModule("util", "compileJava", "jar", "classes");
    myProjectModel.addModule("notReallyAGradleProject");
    ProjectImportAction.AllModels allModels = new ProjectImportAction.AllModels(myProjectModel);
    allModels.addExtraProject(myAndroidProject, AndroidProject.class, myAndroidModuleModel);
    allModels.addExtraProject(myNativeAndroidProject, NativeAndroidProject.class, myNativeAndroidModuleModel);
    ExternalSystemTaskId id = ExternalSystemTaskId.create(SYSTEM_ID, RESOLVE_PROJECT, myProjectModel.getName());
    String projectPath = toSystemDependentName(myProjectModel.getBuildFile().getParent());
    ExternalSystemTaskNotificationListener notificationListener = new ExternalSystemTaskNotificationListenerAdapter() {
    };
    myResolverCtx = new DefaultProjectResolverContext(id, projectPath, null, mock(ProjectConnection.class), notificationListener, true);
    myResolverCtx.setModels(allModels);
    myProjectResolver = new AndroidGradleProjectResolver(myCommandLineArgs, myErrorHandler, myProjectFinder, myVariantSelector);
    myProjectResolver.setProjectResolverContext(myResolverCtx);
    GradleProjectResolverExtension next = new BaseGradleProjectResolverExtension();
    next.setProjectResolverContext(myResolverCtx);
    myProjectResolver.setNext(next);
}
Also used : GradleProjectResolverExtension(org.jetbrains.plugins.gradle.service.project.GradleProjectResolverExtension) BaseGradleProjectResolverExtension(org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension) ExternalSystemTaskId(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId) BaseGradleProjectResolverExtension(org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension) ExternalSystemTaskNotificationListener(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener) IdeaProjectStub(com.android.tools.idea.gradle.stubs.gradle.IdeaProjectStub) DefaultProjectResolverContext(org.jetbrains.plugins.gradle.service.project.DefaultProjectResolverContext) ExternalSystemTaskNotificationListenerAdapter(com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter) ProjectImportAction(org.jetbrains.plugins.gradle.model.ProjectImportAction)

Aggregations

IdeaProjectStub (com.android.tools.idea.gradle.stubs.gradle.IdeaProjectStub)1 ExternalSystemTaskId (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId)1 ExternalSystemTaskNotificationListener (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListener)1 ExternalSystemTaskNotificationListenerAdapter (com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter)1 ProjectImportAction (org.jetbrains.plugins.gradle.model.ProjectImportAction)1 BaseGradleProjectResolverExtension (org.jetbrains.plugins.gradle.service.project.BaseGradleProjectResolverExtension)1 DefaultProjectResolverContext (org.jetbrains.plugins.gradle.service.project.DefaultProjectResolverContext)1 GradleProjectResolverExtension (org.jetbrains.plugins.gradle.service.project.GradleProjectResolverExtension)1