Search in sources :

Example 16 with LocalProperties

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

the class SdkSyncTest method testSyncIdeAndProjectAndroidHomesWhenUserDoesNotSelectValidSdkPath.

public void testSyncIdeAndProjectAndroidHomesWhenUserDoesNotSelectValidSdkPath() throws Exception {
    SdkSync.FindValidSdkPathTask task = new SdkSync.FindValidSdkPathTask(myIdeSdks) {

        @Nullable
        @Override
        File selectValidSdkPath() {
            return null;
        }
    };
    try {
        mySdkSync.syncIdeAndProjectAndroidSdk(myLocalProperties, task, myProject);
        fail("Expecting ExternalSystemException");
    } catch (ExternalSystemException e) {
    // expected
    }
    assertNull(myIdeSdks.getAndroidSdkPath());
    myLocalProperties = new LocalProperties(myProject);
    assertNull(myLocalProperties.getAndroidSdkPath());
}
Also used : ExternalSystemException(com.intellij.openapi.externalSystem.model.ExternalSystemException) LocalProperties(com.android.tools.idea.gradle.util.LocalProperties)

Example 17 with LocalProperties

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

the class SdkSyncTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    AndroidTestCaseHelper.removeExistingAndroidSdks();
    myLocalProperties = new LocalProperties(myProject);
    myAndroidSdkPath = TestUtils.getSdk();
    myIdeSdks = IdeSdks.getInstance();
    mySdkSync = new SdkSync(myIdeSdks);
    assertNull(myIdeSdks.getAndroidSdkPath());
}
Also used : LocalProperties(com.android.tools.idea.gradle.util.LocalProperties)

Aggregations

LocalProperties (com.android.tools.idea.gradle.util.LocalProperties)17 File (java.io.File)8 IOException (java.io.IOException)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)2 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)2 HashSet (com.intellij.util.containers.HashSet)2 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)2 AndroidSdkData (org.jetbrains.android.sdk.AndroidSdkData)2 TestUtils.getWorkspaceFile (com.android.testutils.TestUtils.getWorkspaceFile)1 GradleBuildFile (com.android.tools.idea.gradle.parser.GradleBuildFile)1 GradleUtil.getGradleBuildFile (com.android.tools.idea.gradle.util.GradleUtil.getGradleBuildFile)1 IdeSdks (com.android.tools.idea.sdk.IdeSdks)1 ExternalSystemException (com.intellij.openapi.externalSystem.model.ExternalSystemException)1 Project (com.intellij.openapi.project.Project)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 PsiFile (com.intellij.psi.PsiFile)1 List (java.util.List)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.junit.Test)1