use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class AndroidPluginInfoTest method testFindWithExperimentalPluginReadingBuildFilesOnly.
public void testFindWithExperimentalPluginReadingBuildFilesOnly() throws Exception {
loadProject(EXPERIMENTAL_PLUGIN);
AndroidPluginInfo androidPluginInfo = AndroidPluginInfo.searchInBuildFilesOnly(getProject());
assertNotNull(androidPluginInfo);
assertNotNull(androidPluginInfo.getModule());
assertEquals("app", androidPluginInfo.getModule().getName());
assertEquals(COMPONENT, androidPluginInfo.getPluginGeneration());
assertNotNull(androidPluginInfo.getPluginBuildFile());
assertEquals(new File(getProjectFolderPath(), FN_BUILD_GRADLE), new File(androidPluginInfo.getPluginBuildFile().getPath()));
GradleVersion pluginVersion = androidPluginInfo.getPluginVersion();
assertNotNull(pluginVersion);
assertEquals(BuildEnvironment.getInstance().getExperimentalPluginVersion(), pluginVersion.toString());
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class AndroidPluginInfoTest method testFindWithStablePluginInAppReadingBuildFilesOnly.
public void testFindWithStablePluginInAppReadingBuildFilesOnly() throws Exception {
loadProject(PLUGIN_IN_APP);
AndroidPluginInfo androidPluginInfo = AndroidPluginInfo.searchInBuildFilesOnly(getProject());
assertNotNull(androidPluginInfo);
assertNotNull(androidPluginInfo.getModule());
assertEquals("app", androidPluginInfo.getModule().getName());
assertEquals(ORIGINAL, androidPluginInfo.getPluginGeneration());
assertNotNull(androidPluginInfo.getPluginBuildFile());
assertEquals(new File(new File(getProjectFolderPath(), "app"), FN_BUILD_GRADLE), new File(androidPluginInfo.getPluginBuildFile().getPath()));
GradleVersion pluginVersion = androidPluginInfo.getPluginVersion();
assertNotNull(pluginVersion);
assertEquals(BuildEnvironment.getInstance().getGradlePluginVersion(), pluginVersion.toString());
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class GradleVersionReaderTest method testGetComponentVersion.
public void testGetComponentVersion() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
myOriginalGradleVersions = GradleVersions.getInstance();
GradleVersions gradleVersions = IdeComponents.replaceServiceWithMock(GradleVersions.class);
Project project = getProject();
GradleVersion gradleVersion = GradleVersion.parse("2.14.1");
when(gradleVersions.getGradleVersion(project)).thenReturn(gradleVersion);
String actualGradleVersion = myVersionReader.getComponentVersion(appModule);
assertEquals(gradleVersion.toString(), actualGradleVersion);
verify(gradleVersions).getGradleVersion(project);
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class GradleVersionReaderTest method testGetQuickFixes.
public void testGetQuickFixes() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
List<NotificationHyperlink> quickFixes = myVersionReader.getQuickFixes(appModule, null, null);
assertThat(quickFixes).hasSize(2);
NotificationHyperlink quickFix = quickFixes.get(0);
assertThat(quickFix).isInstanceOf(FixAndroidGradlePluginVersionHyperlink.class);
FixAndroidGradlePluginVersionHyperlink fixAndroidGradlePluginQuickFix = (FixAndroidGradlePluginVersionHyperlink) quickFix;
assertEquals(BuildEnvironment.getInstance().getGradlePluginVersion(), fixAndroidGradlePluginQuickFix.getPluginVersion().toString());
GradleVersion gradleVersion = fixAndroidGradlePluginQuickFix.getGradleVersion();
assertNotNull(gradleVersion);
assertEquals(GRADLE_LATEST_VERSION, gradleVersion.toString());
quickFix = quickFixes.get(1);
assertThat(quickFix).isInstanceOf(OpenUrlHyperlink.class);
OpenUrlHyperlink openUrlQuickFix = (OpenUrlHyperlink) quickFix;
assertEquals("https://developer.android.com/studio/releases/index.html#Revisions", openUrlQuickFix.getUrl());
}
use of com.android.ide.common.repository.GradleVersion in project android by JetBrains.
the class ForcedPluginPreviewVersionUpgradeStepIdeaTest method testCheckAndPerformUpgradeWhenUserDeclinesUpgrade.
// See https://code.google.com/p/android/issues/detail?id=227927
public void testCheckAndPerformUpgradeWhenUserDeclinesUpgrade() {
GradleVersion latestPluginVersion = GradleVersion.parse("2.0.0");
when(myPluginGeneration.getLatestKnownVersion()).thenReturn(latestPluginVersion.toString());
when(myPluginInfo.getPluginVersion()).thenReturn(GradleVersion.parse("2.0.0-alpha9"));
// Simulate user canceling upgrade.
myOriginalTestDialog = ForcedPluginPreviewVersionUpgradeDialog.setTestDialog(new TestMessagesDialog(Messages.CANCEL));
boolean upgraded = myVersionUpgrade.checkAndPerformUpgrade(getProject(), myPluginInfo);
assertTrue(upgraded);
List<SyncMessage> messages = mySyncMessages.getReportedMessages();
assertThat(messages).hasSize(1);
String message = messages.get(0).getText()[1];
assertThat(message).contains("Please update your project to use version 2.0.0.");
verify(mySyncState).syncEnded();
verify(myVersionUpdater, never()).updatePluginVersionAndSync(latestPluginVersion, GradleVersion.parse(GRADLE_LATEST_VERSION), true);
}
Aggregations