use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class GradleVersionsUnitTest method rc.
@Test
public void rc() {
// Regression test for https://code.google.com/p/android/issues/detail?id=179838
File jarFile = new File("gradle-core-2.5-rc-1.jar");
GradleVersion gradleVersion = GradleVersions.getGradleVersionFromJar(jarFile);
assertNotNull(gradleVersion);
assertEquals(GradleVersion.parse("2.5"), gradleVersion);
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class GradleVersionsUnitTest method getGradleVersionFromJarUsingNonGradleLibraryJar.
@Test
public void getGradleVersionFromJarUsingNonGradleLibraryJar() {
File jarFile = new File("ant-1.9.3.jar");
GradleVersion gradleVersion = GradleVersions.getGradleVersionFromJar(jarFile);
assertNull(gradleVersion);
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class GradleVersionsUnitTest method nightly.
@Test
public void nightly() {
File jarFile = new File("gradle-core-2.10-20151029230024+0000.jar");
GradleVersion gradleVersion = GradleVersions.getGradleVersionFromJar(jarFile);
assertNotNull(gradleVersion);
assertEquals(GradleVersion.parse("2.10"), gradleVersion);
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class AndroidGradleJavaProjectModelModifier method findNewExternalDependency.
@Nullable
private static ArtifactDependencySpec findNewExternalDependency(@NotNull Library library, @NotNull AndroidModuleModel androidModel) {
GradleVersion modelVersion = androidModel.getModelVersion();
JavaLibrary matchedLibrary = null;
for (BaseArtifact testArtifact : androidModel.getTestArtifactsInSelectedVariant()) {
matchedLibrary = findMatchedLibrary(library, testArtifact, modelVersion);
if (matchedLibrary != null) {
break;
}
}
if (matchedLibrary == null) {
Variant selectedVariant = androidModel.getSelectedVariant();
matchedLibrary = findMatchedLibrary(library, selectedVariant.getMainArtifact(), modelVersion);
}
if (matchedLibrary == null) {
return null;
}
// TODO use getRequestedCoordinates once the interface is fixed.
MavenCoordinates coordinates = matchedLibrary.getResolvedCoordinates();
if (coordinates == null) {
return null;
}
return new ArtifactDependencySpec(coordinates.getArtifactId(), coordinates.getGroupId(), coordinates.getVersion());
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class AndroidContentEntriesSetup method addGeneratedSourceFolders.
private void addGeneratedSourceFolders(@NotNull BaseArtifact artifact, @NotNull List<ContentEntry> contentEntries, boolean isTest) {
JpsModuleSourceRootType sourceType = getSourceType(isTest);
GradleVersion modelVersion = myAndroidModel.getModelVersion();
if (artifact instanceof AndroidArtifact || (modelVersion != null && modelVersion.compareIgnoringQualifiers("1.2") >= 0)) {
// getGeneratedSourceFolders used to be in AndroidArtifact only.
Collection<File> generatedSourceFolders = getGeneratedSourceFolders(artifact);
//noinspection ConstantConditions - this returned null in 1.2
if (generatedSourceFolders != null) {
addSourceFolders(generatedSourceFolders, contentEntries, sourceType, true);
}
}
if (artifact instanceof AndroidArtifact) {
sourceType = getResourceSourceType(isTest);
AndroidArtifact androidArtifact = (AndroidArtifact) artifact;
addSourceFolders(androidArtifact.getGeneratedResourceFolders(), contentEntries, sourceType, true);
}
}
Aggregations