Search in sources :

Example 1 with AndroidGradleProjectComponent

use of com.android.tools.idea.gradle.project.AndroidGradleProjectComponent in project android by JetBrains.

the class AndroidGradleTestCase method tearDown.

@Override
protected void tearDown() throws Exception {
    myModules = null;
    try {
        Messages.setTestDialog(TestDialog.DEFAULT);
        if (myFixture != null) {
            try {
                Project project = myFixture.getProject();
                // that here, otherwise the testsuite will leak
                if (AndroidProjectInfo.getInstance(project).requiresAndroidModel()) {
                    AndroidGradleProjectComponent projectComponent = AndroidGradleProjectComponent.getInstance(project);
                    projectComponent.projectClosed();
                }
            } finally {
                try {
                    myFixture.tearDown();
                } catch (Exception e) {
                    LOG.warn("Failed to tear down " + myFixture.getClass().getSimpleName(), e);
                }
                myFixture = null;
            }
        }
        GradleProjectImporter.ourSkipSetupFromTest = false;
        ProjectManagerEx projectManager = ProjectManagerEx.getInstanceEx();
        Project[] openProjects = projectManager.getOpenProjects();
        if (openProjects.length > 0) {
            PlatformTestCase.closeAndDisposeProjectAndCheckThatNoOpenProjects(openProjects[0]);
        }
    } finally {
        try {
            assertEquals(0, ProjectManager.getInstance().getOpenProjects().length);
        } finally {
            //noinspection ThrowFromFinallyBlock
            super.tearDown();
        }
    }
}
Also used : AndroidGradleProjectComponent(com.android.tools.idea.gradle.project.AndroidGradleProjectComponent) Projects.isLegacyIdeaAndroidProject(com.android.tools.idea.gradle.util.Projects.isLegacyIdeaAndroidProject) Project(com.intellij.openapi.project.Project) ProjectManagerEx(com.intellij.openapi.project.ex.ProjectManagerEx) ConfigurationException(com.intellij.openapi.options.ConfigurationException) IOException(java.io.IOException)

Aggregations

AndroidGradleProjectComponent (com.android.tools.idea.gradle.project.AndroidGradleProjectComponent)1 Projects.isLegacyIdeaAndroidProject (com.android.tools.idea.gradle.util.Projects.isLegacyIdeaAndroidProject)1 ConfigurationException (com.intellij.openapi.options.ConfigurationException)1 Project (com.intellij.openapi.project.Project)1 ProjectManagerEx (com.intellij.openapi.project.ex.ProjectManagerEx)1 IOException (java.io.IOException)1