Search in sources :

Example 1 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class ExtraGeneratedFolderValidationStrategyTest method testFixAndReportFoundIssues.

public void testFixAndReportFoundIssues() {
    List<File> paths = myStrategy.getExtraGeneratedSourceFolderPaths();
    paths.add(new File("z"));
    paths.add(new File("a"));
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.fixAndReportFoundIssues();
    List<SyncMessage> messages = syncMessages.getReportedMessages();
    assertThat(messages).hasSize(3);
    // @formatter:off
    assertAbout(syncMessage()).that(messages.get(0)).hasType(WARNING).hasMessageLine("Folder a", 0);
    assertAbout(syncMessage()).that(messages.get(1)).hasType(WARNING).hasMessageLine("Folder z", 0);
    assertAbout(syncMessage()).that(messages.get(2)).hasType(INFO).hasMessageLine("3rd-party Gradle plug-ins may be the cause", 0);
// @formatter:on
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub) File(java.io.File)

Example 2 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class LayoutRenderingIssueValidationStrategyTest method testFixAndReportFoundIssues.

// See https://code.google.com/p/android/issues/detail?id=170841
public void testFixAndReportFoundIssues() {
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.setModelVersion(GradleVersion.parse("1.2.0"));
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNotNull(message);
    String[] text = message.getText();
    assertThat(text).isNotEmpty();
    assertThat(text[0]).startsWith("Using an obsolete version of the Gradle plugin (1.2.0)");
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 3 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class LayoutRenderingIssueValidationStrategyTest method testFixAndReportFoundIssuesWithNoIssues.

public void testFixAndReportFoundIssuesWithNoIssues() {
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(getProject());
    myStrategy.setModelVersion(null);
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 4 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class BuildTools23Rc1ValidationStrategyTest method testFixAndReportFoundIssues.

public void testFixAndReportFoundIssues() {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    myStrategy.getModules().add("app");
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNotNull(message);
    String[] text = message.getText();
    assertThat(text).isNotEmpty();
    assertThat(text[0]).startsWith("Build Tools 23.0.0 rc1 is <b>deprecated</b>");
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) AndroidProject(com.android.builder.model.AndroidProject) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Example 5 with SyncMessagesStub

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub in project android by JetBrains.

the class BuildTools23Rc1ValidationStrategyTest method testFixAndReportFoundIssuesWithNoIssues.

public void testFixAndReportFoundIssuesWithNoIssues() {
    Project project = getProject();
    SyncMessagesStub syncMessages = SyncMessagesStub.replaceSyncMessagesService(project);
    myStrategy.getModules().clear();
    myStrategy.fixAndReportFoundIssues();
    SyncMessage message = syncMessages.getFirstReportedMessage();
    assertNull(message);
}
Also used : SyncMessage(com.android.tools.idea.gradle.project.sync.messages.SyncMessage) AndroidProject(com.android.builder.model.AndroidProject) Project(com.intellij.openapi.project.Project) SyncMessagesStub(com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)

Aggregations

SyncMessage (com.android.tools.idea.gradle.project.sync.messages.SyncMessage)12 SyncMessagesStub (com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)12 Project (com.intellij.openapi.project.Project)5 Module (com.intellij.openapi.module.Module)3 AndroidProject (com.android.builder.model.AndroidProject)2 ProjectSubset (com.android.tools.idea.gradle.project.subset.ProjectSubset)2 File (java.io.File)2 GradleBuildModel (com.android.tools.idea.gradle.dsl.model.GradleBuildModel)1 ArtifactDependencyModel (com.android.tools.idea.gradle.dsl.model.dependencies.ArtifactDependencyModel)1 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)1 GradleSyncSummary (com.android.tools.idea.gradle.project.sync.GradleSyncSummary)1 GradleUtil.getAndroidProject (com.android.tools.idea.gradle.util.GradleUtil.getAndroidProject)1 Sdk (com.intellij.openapi.projectRoots.Sdk)1 VfsUtil.findFileByIoFile (com.intellij.openapi.vfs.VfsUtil.findFileByIoFile)1 VirtualFile (com.intellij.openapi.vfs.VirtualFile)1