use of com.android.tools.idea.gradle.project.sync.GradleSyncSummary in project android by JetBrains.
the class GradleVersionsTest method simulateGradleSyncStateReturnNullGradleVersion.
private void simulateGradleSyncStateReturnNullGradleVersion() {
GradleSyncState syncState = mock(GradleSyncState.class);
IdeComponents.replaceService(getProject(), GradleSyncState.class, syncState);
GradleSyncSummary summary = mock(GradleSyncSummary.class);
when(summary.getGradleVersion()).thenReturn(null);
when(syncState.getSummary()).thenReturn(summary);
}
use of com.android.tools.idea.gradle.project.sync.GradleSyncSummary in project android by JetBrains.
the class GradleModuleSetup method setUpModule.
public void setUpModule(@NotNull Module module, @NotNull IdeModifiableModelsProvider ideModelsProvider, @NotNull GradleModuleModel model) {
GradleFacet facet = findFacet(module, ideModelsProvider, GradleFacet.getFacetTypeId());
if (facet == null) {
ModifiableFacetModel facetModel = ideModelsProvider.getModifiableFacetModel(module);
GradleFacetType facetType = GradleFacet.getFacetType();
facet = facetType.createFacet(module, GradleFacet.getFacetName(), facetType.createDefaultConfiguration(), null);
facetModel.addFacet(facet);
}
facet.setGradleModuleModel(model);
String gradleVersion = model.getGradleVersion();
GradleSyncSummary syncReport = GradleSyncState.getInstance(module.getProject()).getSummary();
if (isNotEmpty(gradleVersion) && syncReport.getGradleVersion() == null) {
syncReport.setGradleVersion(GradleVersion.parse(gradleVersion));
}
}
use of com.android.tools.idea.gradle.project.sync.GradleSyncSummary in project android by JetBrains.
the class GradleProjectInfoTest method registerLastSyncTimestamp.
private void registerLastSyncTimestamp(long timestamp) {
GradleSyncSummary summary = mock(GradleSyncSummary.class);
when(summary.getSyncTimestamp()).thenReturn(timestamp);
GradleSyncState syncState = IdeComponents.replaceServiceWithMock(getProject(), GradleSyncState.class);
when(syncState.getSummary()).thenReturn(summary);
}
use of com.android.tools.idea.gradle.project.sync.GradleSyncSummary in project android by JetBrains.
the class JdkModuleSetupStepTest method testSetUpInAndroidStudio.
public void testSetUpInAndroidStudio() throws Exception {
loadSimpleApplication();
Module appModule = myModules.getAppModule();
AndroidModuleModel androidModel = AndroidModuleModel.get(appModule);
assertNotNull(androidModel);
Sdk jdk = mock(Sdk.class);
when(myIdeSdks.getJdk()).thenReturn(jdk);
when(myJdks.isApplicableJdk(jdk, JDK_1_7)).thenReturn(false);
SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
mySetupStep.setUpInAndroidStudio(appModule, androidModel);
SyncMessage message = syncMessages.getFirstReportedMessage();
assertNotNull(message);
String[] text = message.getText();
assertThat(text).isNotEmpty();
assertThat(text[0]).matches("compileSdkVersion (.*) requires compiling with JDK 7 or newer.");
GradleSyncSummary summary = GradleSyncState.getInstance(getProject()).getSummary();
assertTrue(summary.hasSyncErrors());
}
use of com.android.tools.idea.gradle.project.sync.GradleSyncSummary in project android by JetBrains.
the class GradleModuleSetupTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
initMocks(this);
Project project = getProject();
IdeComponents.replaceService(project, GradleSyncState.class, mySyncState);
String moduleName = "app";
myModule = createModule(moduleName);
IdeaProjectStub projectModel = new IdeaProjectStub(project.getName());
myModuleModel = projectModel.addModule(moduleName, "task1", "task2");
mySyncSummary = new GradleSyncSummary(project);
when(mySyncState.getSummary()).thenReturn(mySyncSummary);
myModelsProvider = new IdeModifiableModelsProviderImpl(project);
myModuleSetup = new GradleModuleSetup();
}
Aggregations