Search in sources :

Example 31 with StudioLoggerProgressIndicator

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

the class ComponentInstaller method getPackagesToInstall.

public List<RemotePackage> getPackagesToInstall(@NotNull Iterable<? extends InstallableComponent> components) throws SdkQuickfixUtils.PackageResolutionException {
    // TODO: Prompt about connection in handoff case?
    Set<UpdatablePackage> requests = Sets.newHashSet();
    StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
    RepoManager sdkManager = mySdkHandler.getSdkManager(progress);
    for (InstallableComponent component : components) {
        requests.addAll(component.getPackagesToInstall());
    }
    List<UpdatablePackage> resolved = Lists.newArrayList();
    resolved.addAll(SdkQuickfixUtils.resolve(requests, sdkManager.getPackages()));
    List<RemotePackage> result = Lists.newArrayList();
    for (UpdatablePackage p : resolved) {
        result.add(p.getRemote());
    }
    return result;
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)

Example 32 with StudioLoggerProgressIndicator

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

the class GradleImport method getBuildToolsVersion.

String getBuildToolsVersion() {
    AndroidSdkHandler sdkHandler = AndroidSdkHandler.getInstance(mySdkLocation);
    StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(getClass());
    BuildToolInfo buildTool = sdkHandler.getLatestBuildTool(progress, false);
    if (buildTool == null) {
        buildTool = sdkHandler.getLatestBuildTool(progress, true);
    }
    if (buildTool != null) {
        return buildTool.getRevision().toString();
    }
    return CURRENT_BUILD_TOOLS_VERSION;
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) BuildToolInfo(com.android.sdklib.BuildToolInfo) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler)

Example 33 with StudioLoggerProgressIndicator

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

the class IdeSdks method isJdk7Supported.

public boolean isJdk7Supported(@Nullable AndroidSdkData sdkData) {
    if (sdkData != null) {
        ProgressIndicator progress = new StudioLoggerProgressIndicator(Jdks.class);
        LocalPackage info = sdkData.getSdkHandler().getLocalPackage(SdkConstants.FD_PLATFORM_TOOLS, progress);
        if (info != null) {
            Revision revision = info.getVersion();
            if (revision.getMajor() >= 19) {
                JavaSdk jdk = JavaSdk.getInstance();
                Sdk sdk = ProjectJdkTable.getInstance().findMostRecentSdkOfType(jdk);
                if (sdk != null) {
                    JavaSdkVersion version = jdk.getVersion(sdk);
                    if (version != null && version.isAtLeast(JavaSdkVersion.JDK_1_7)) {
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) LocalPackage(com.android.repository.api.LocalPackage) Revision(com.android.repository.Revision) StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) ProgressIndicator(com.android.repository.api.ProgressIndicator) SdkPaths.validateAndroidSdk(com.android.tools.idea.sdk.SdkPaths.validateAndroidSdk)

Example 34 with StudioLoggerProgressIndicator

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

the class AndroidSdks method tryToCreate.

@Nullable
public Sdk tryToCreate(@NotNull File sdkPath, @NotNull String targetHashString) {
    AndroidSdkData sdkData = getSdkData(sdkPath);
    if (sdkData != null) {
        sdkData.getSdkHandler().getSdkManager(new StudioLoggerProgressIndicator(AndroidSdks.class)).markInvalid();
        IAndroidTarget target = sdkData.findTargetByHashString(targetHashString);
        if (target != null) {
            return create(target, sdkData.getLocation(), true);
        }
    }
    return null;
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) AndroidSdkData(org.jetbrains.android.sdk.AndroidSdkData) IAndroidTarget(com.android.sdklib.IAndroidTarget) Nullable(org.jetbrains.annotations.Nullable)

Example 35 with StudioLoggerProgressIndicator

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

the class NewModuleWizardState method putSdkDependentParams.

public void putSdkDependentParams() {
    final AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
    BuildToolInfo buildTool = sdkHandler.getLatestBuildTool(new StudioLoggerProgressIndicator(getClass()), false);
    if (buildTool != null) {
        // If buildTool is null, the template will use buildApi instead, which might be good enough.
        put(ATTR_BUILD_TOOLS_VERSION, buildTool.getRevision().toString());
    }
    File location = sdkHandler.getLocation();
    if (location != null) {
        // Gradle expects a platform-neutral path
        put(ATTR_SDK_DIR, FileUtil.toSystemIndependentName(location.getPath()));
    }
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) BuildToolInfo(com.android.sdklib.BuildToolInfo) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) VirtualFile(com.intellij.openapi.vfs.VirtualFile) File(java.io.File)

Aggregations

StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)40 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)22 File (java.io.File)11 Nullable (org.jetbrains.annotations.Nullable)9 RepoManager (com.android.repository.api.RepoManager)8 StudioDownloader (com.android.tools.idea.sdk.StudioDownloader)8 ProgressIndicator (com.android.repository.api.ProgressIndicator)7 Revision (com.android.repository.Revision)6 LocalPackage (com.android.repository.api.LocalPackage)6 RemotePackage (com.android.repository.api.RemotePackage)6 BuildToolInfo (com.android.sdklib.BuildToolInfo)6 NotNull (org.jetbrains.annotations.NotNull)6 IAndroidTarget (com.android.sdklib.IAndroidTarget)4 AndroidSdkData (org.jetbrains.android.sdk.AndroidSdkData)4 VisibleForTesting (com.android.annotations.VisibleForTesting)3 GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)3 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)3 GradleSyncInvoker (com.android.tools.idea.gradle.project.sync.GradleSyncInvoker)3 StudioProgressRunner (com.android.tools.idea.sdk.progress.StudioProgressRunner)3 ImmutableList (com.google.common.collect.ImmutableList)3