Search in sources :

Example 6 with RepoManager

use of com.android.repository.api.RepoManager in project android by JetBrains.

the class RepositoryUrlManagerTest method testResolvedCoordinateRemoteSdk.

public void testResolvedCoordinateRemoteSdk() throws Exception {
    RemotePackage pkg = new FakePackage.FakeRemotePackage("extras;m2repository;com;google;android;gms;play-services;4.5.0");
    RepositoryPackages pkgs = new RepositoryPackages(ImmutableList.of(), ImmutableList.of(pkg));
    RepoManager mgr = new FakeRepoManager(pkgs);
    mySdkHandler = new AndroidSdkHandler(new File("/emptysdk"), ANDROID_HOME, myFileOp, mgr);
    GradleCoordinate coordinate = GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.+");
    assertNotNull(coordinate);
    assertEquals("4.5.0", resolveDynamicCoordinateVersion(coordinate));
}
Also used : RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RepoManager(com.android.repository.api.RepoManager) GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) RemotePackage(com.android.repository.api.RemotePackage) File(java.io.File)

Example 7 with RepoManager

use of com.android.repository.api.RepoManager in project android by JetBrains.

the class StudioSdkUtil method reloadRemoteSdkWithModalProgress.

/**
   * Convenience method to reload the local and remote SDK, showing a modal, non-cancellable progress window.
   */
public static void reloadRemoteSdkWithModalProgress() {
    final AndroidSdkHandler sdkHandler = AndroidSdks.getInstance().tryToChooseSdkHandler();
    StudioProgressRunner runner = new StudioProgressRunner(true, false, "Refreshing SDK", false, null);
    StudioLoggerProgressIndicator progress = new StudioLoggerProgressIndicator(StudioSdkUtil.class);
    RepoManager sdkManager = sdkHandler.getSdkManager(progress);
    sdkManager.load(RepoManager.DEFAULT_EXPIRATION_PERIOD_MS, null, null, null, runner, new StudioDownloader(null), StudioSettingsController.getInstance(), true);
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) StudioProgressRunner(com.android.tools.idea.sdk.progress.StudioProgressRunner) RepoManager(com.android.repository.api.RepoManager) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler)

Example 8 with RepoManager

use of com.android.repository.api.RepoManager in project android by JetBrains.

the class AvdWizardUtilsTest method createMockSdk.

@NotNull
private static AndroidSdkHandler createMockSdk(String versionString, String path) {
    FakeLocalPackage p = new FakeLocalPackage(path);
    p.setRevision(Revision.parseRevision(versionString));
    RepositoryPackages packages = new RepositoryPackages();
    packages.setLocalPkgInfos(ImmutableList.of(p));
    RepoManager mgr = new FakeRepoManager(null, packages);
    return new AndroidSdkHandler(null, null, new MockFileOp(), mgr);
}
Also used : FakeLocalPackage(com.android.repository.testframework.FakePackage.FakeLocalPackage) RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RepoManager(com.android.repository.api.RepoManager) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) MockFileOp(com.android.repository.testframework.MockFileOp) NotNull(org.jetbrains.annotations.NotNull)

Example 9 with RepoManager

use of com.android.repository.api.RepoManager in project android by JetBrains.

the class SdkMergerTest method getSdkFingerprint.

private String getSdkFingerprint(File sdk) {
    StringBuilder s = new StringBuilder();
    RepoManager sdkManager = AndroidSdkHandler.getInstance(sdk).getSdkManager(new StudioLoggerProgressIndicator(getClass()));
    for (LocalPackage p : Sets.newTreeSet(sdkManager.getPackages().getLocalPackages().values())) {
        s.append(p.getPath());
        s.append(',');
        s.append(p.getVersion());
        s.append('\n');
    }
    return s.toString();
}
Also used : StudioLoggerProgressIndicator(com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator) LocalPackage(com.android.repository.api.LocalPackage) RepoManager(com.android.repository.api.RepoManager)

Example 10 with RepoManager

use of com.android.repository.api.RepoManager in project android by JetBrains.

the class RepositoryUrlManagerTest method testResolvedCoordinateLocalFirst.

public void testResolvedCoordinateLocalFirst() throws Exception {
    RemotePackage pkg = new FakePackage.FakeRemotePackage("extras;m2repository;com;google;android;gms;play-services;4.5.0");
    RepositoryPackages pkgs = new RepositoryPackages(ImmutableList.of(), ImmutableList.of(pkg));
    RepoManager mgr = new FakeRepoManager(pkgs);
    mySdkHandler = new AndroidSdkHandler(SDK_DIR, ANDROID_HOME, myFileOp, mgr);
    GradleCoordinate coordinate = GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.+");
    assertNotNull(coordinate);
    assertEquals("4.4.52", resolveDynamicCoordinateVersion(coordinate));
}
Also used : RepositoryPackages(com.android.repository.impl.meta.RepositoryPackages) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) RepoManager(com.android.repository.api.RepoManager) GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) FakeRepoManager(com.android.repository.testframework.FakeRepoManager) AndroidSdkHandler(com.android.sdklib.repository.AndroidSdkHandler) RemotePackage(com.android.repository.api.RemotePackage)

Aggregations

RepoManager (com.android.repository.api.RepoManager)10 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)7 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)7 RemotePackage (com.android.repository.api.RemotePackage)5 StudioDownloader (com.android.tools.idea.sdk.StudioDownloader)4 NotNull (org.jetbrains.annotations.NotNull)4 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)3 FakeRepoManager (com.android.repository.testframework.FakeRepoManager)3 StudioProgressRunner (com.android.tools.idea.sdk.progress.StudioProgressRunner)3 GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)2 DEFAULT_EXPIRATION_PERIOD_MS (com.android.repository.api.RepoManager.DEFAULT_EXPIRATION_PERIOD_MS)2 GradleSyncInvoker (com.android.tools.idea.gradle.project.sync.GradleSyncInvoker)2 AndroidSdks (com.android.tools.idea.sdk.AndroidSdks)2 StudioSettingsController (com.android.tools.idea.sdk.StudioSettingsController)2 SdkQuickfixUtils.createDialogForPaths (com.android.tools.idea.sdk.wizard.SdkQuickfixUtils.createDialogForPaths)2 ModelWizardDialog (com.android.tools.idea.wizard.model.ModelWizardDialog)2 ImmutableList (com.google.common.collect.ImmutableList)2 Project (com.intellij.openapi.project.Project)2 Messages (com.intellij.openapi.ui.Messages)2 File (java.io.File)2