Search in sources :

Example 31 with GradleCoordinate

use of com.android.ide.common.repository.GradleCoordinate in project android by JetBrains.

the class RepositoryUrlManagerTest method testResolvedCoordinate_sdkMissing.

public void testResolvedCoordinate_sdkMissing() throws Exception {
    myFileOp.deleteFileOrFolder(SDK_DIR);
    GradleCoordinate coordinate = GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.+");
    assertNull(resolveDynamicCoordinateVersion(coordinate));
}
Also used : GradleCoordinate(com.android.ide.common.repository.GradleCoordinate)

Example 32 with GradleCoordinate

use of com.android.ide.common.repository.GradleCoordinate 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)

Example 33 with GradleCoordinate

use of com.android.ide.common.repository.GradleCoordinate in project android by JetBrains.

the class RepositoryUrlManagerTest method testResolvedCoordinate.

public void testResolvedCoordinate() throws Exception {
    GradleCoordinate coordinate = GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.+");
    assertNotNull(coordinate);
    assertEquals("4.4.52", resolveDynamicCoordinateVersion(coordinate));
    assertEquals(GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.4.52"), resolveDynamicCoordinate(coordinate));
    coordinate = GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.+@aar");
    assertNotNull(coordinate);
    assertEquals("4.4.52", resolveDynamicCoordinateVersion(coordinate));
    assertEquals(GradleCoordinate.parseCoordinateString("com.google.android.gms:play-services:4.4.52@aar"), resolveDynamicCoordinate(coordinate));
    coordinate = GradleCoordinate.parseCoordinateString("com.android.support:support-v4:+");
    assertNotNull(coordinate);
    assertEquals("21.0.2", resolveDynamicCoordinateVersion(coordinate));
    // Make sure already resolved coordinates are handled correctly
    coordinate = GradleCoordinate.parseCoordinateString("com.android.support:support-v4:1.2.3");
    assertNotNull(coordinate);
    assertEquals("1.2.3", resolveDynamicCoordinateVersion(coordinate));
    coordinate = GradleCoordinate.parseCoordinateString("my.group.id:my.bogus.artifact:+");
    assertNotNull(coordinate);
    assertNull(resolveDynamicCoordinateVersion(coordinate));
}
Also used : GradleCoordinate(com.android.ide.common.repository.GradleCoordinate)

Example 34 with GradleCoordinate

use of com.android.ide.common.repository.GradleCoordinate in project android by JetBrains.

the class DependencyManager method checkForNewMissingDependencies.

private boolean checkForNewMissingDependencies() {
    Set<String> missing = Collections.emptySet();
    if (myModule != null) {
        GradleDependencyManager manager = GradleDependencyManager.getInstance(myProject);
        List<GradleCoordinate> coordinates = toGradleCoordinatesFromIds(myPalette.getGradleCoordinateIds());
        missing = fromGradleCoordinatesToIds(manager.findMissingDependencies(myModule, coordinates));
        if (myMissingLibraries.equals(missing)) {
            return false;
        }
    }
    myMissingLibraries.clear();
    myMissingLibraries.addAll(missing);
    return true;
}
Also used : GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) GradleDependencyManager(com.android.tools.idea.gradle.dependencies.GradleDependencyManager)

Example 35 with GradleCoordinate

use of com.android.ide.common.repository.GradleCoordinate in project android by JetBrains.

the class NlOldPalettePanel method checkForNewMissingDependencies.

private boolean checkForNewMissingDependencies() {
    Module module = getModule();
    List<String> missing = Collections.emptyList();
    if (module != null) {
        GradleDependencyManager manager = GradleDependencyManager.getInstance(myProject);
        Palette palette = myModel.getPalette(myDesignSurface.getLayoutType());
        List<GradleCoordinate> dependencies = toGradleCoordinates(palette.getGradleCoordinateIds());
        missing = fromGradleCoordinates(manager.findMissingDependencies(module, dependencies));
        if (missing.size() == myMissingLibraries.size() && myMissingLibraries.containsAll(missing)) {
            return false;
        }
    }
    myMissingLibraries.clear();
    myMissingLibraries.addAll(missing);
    return true;
}
Also used : GradleCoordinate(com.android.ide.common.repository.GradleCoordinate) Module(com.intellij.openapi.module.Module) GradleDependencyManager(com.android.tools.idea.gradle.dependencies.GradleDependencyManager)

Aggregations

GradleCoordinate (com.android.ide.common.repository.GradleCoordinate)35 File (java.io.File)9 GradleDependencyManager (com.android.tools.idea.gradle.dependencies.GradleDependencyManager)5 NotNull (org.jetbrains.annotations.NotNull)5 RemotePackage (com.android.repository.api.RemotePackage)4 AndroidSdkHandler (com.android.sdklib.repository.AndroidSdkHandler)3 GradleBuildModel (com.android.tools.idea.gradle.dsl.model.GradleBuildModel)3 ArtifactDependencyModel (com.android.tools.idea.gradle.dsl.model.dependencies.ArtifactDependencyModel)3 StudioLoggerProgressIndicator (com.android.tools.idea.sdk.progress.StudioLoggerProgressIndicator)3 Project (com.intellij.openapi.project.Project)3 IOException (java.io.IOException)3 Nullable (org.jetbrains.annotations.Nullable)3 Nullable (com.android.annotations.Nullable)2 SdkMavenRepository (com.android.ide.common.repository.SdkMavenRepository)2 RepoManager (com.android.repository.api.RepoManager)2 RepoPackage (com.android.repository.api.RepoPackage)2 RepositoryPackages (com.android.repository.impl.meta.RepositoryPackages)2 FakeRepoManager (com.android.repository.testframework.FakeRepoManager)2 DependenciesModel (com.android.tools.idea.gradle.dsl.model.dependencies.DependenciesModel)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)2