Search in sources :

Example 6 with IdeSdks

use of com.android.tools.idea.sdk.IdeSdks in project android by JetBrains.

the class GuiTests method setUpSdks.

public static void setUpSdks() {
    File androidSdkPath = TestUtils.getSdk();
    execute(new GuiTask() {

        @Override
        protected void executeInEDT() throws Throwable {
            IdeSdks ideSdks = IdeSdks.getInstance();
            File currentAndroidSdkPath = ideSdks.getAndroidSdkPath();
            if (!filesEqual(androidSdkPath, currentAndroidSdkPath)) {
                ApplicationManager.getApplication().runWriteAction(() -> {
                    System.out.println(String.format("Setting Android SDK: '%1$s'", androidSdkPath.getPath()));
                    ideSdks.setAndroidSdkPath(androidSdkPath, null);
                    ideSdks.setUseEmbeddedJdk();
                    System.out.println(String.format("Setting JDK: '%1$s'", ideSdks.getJdkPath()));
                    System.out.println();
                });
            }
        }
    });
}
Also used : GuiTask(org.fest.swing.edt.GuiTask) IdeSdks(com.android.tools.idea.sdk.IdeSdks) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Example 7 with IdeSdks

use of com.android.tools.idea.sdk.IdeSdks in project android by JetBrains.

the class AndroidGradleBuildProcessParametersProviderTest method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    IdeSdks ideSdks = IdeSdks.getInstance();
    if (IdeInfo.getInstance().isAndroidStudio()) {
        ApplicationManager.getApplication().runWriteAction(ideSdks::setUseEmbeddedJdk);
    }
    File jdkPath = ideSdks.getJdkPath();
    assert jdkPath != null;
    myJdk = Jdks.getInstance().createJdk(jdkPath.getPath());
    myParametersProvider = new AndroidGradleBuildProcessParametersProvider(myProject);
}
Also used : IdeSdks(com.android.tools.idea.sdk.IdeSdks) File(java.io.File)

Aggregations

IdeSdks (com.android.tools.idea.sdk.IdeSdks)7 File (java.io.File)7 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 Sdk (com.intellij.openapi.projectRoots.Sdk)2 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)1 TestUtils.getSdk (com.android.testutils.TestUtils.getSdk)1 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 LocalProperties (com.android.tools.idea.gradle.util.LocalProperties)1 ValidationResult (com.android.tools.idea.npw.WizardUtils.ValidationResult)1 SystemInfoStatsMonitor (com.android.tools.idea.sdk.SystemInfoStatsMonitor)1 PatchInstallingRestarter (com.android.tools.idea.sdk.install.patch.PatchInstallingRestarter)1 FirstRunWizardMode (com.android.tools.idea.welcome.config.FirstRunWizardMode)1 SdkModificator (com.intellij.openapi.projectRoots.SdkModificator)1 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)1 VfsUtilCore.virtualToIoFile (com.intellij.openapi.vfs.VfsUtilCore.virtualToIoFile)1 PsiFile (com.intellij.psi.PsiFile)1 IOException (java.io.IOException)1 GuiTask (org.fest.swing.edt.GuiTask)1