Search in sources :

Example 26 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage 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 27 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage 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 28 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage 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 29 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage 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 30 with SyncMessage

use of com.android.tools.idea.gradle.project.sync.messages.SyncMessage 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)55 Module (com.intellij.openapi.module.Module)18 Project (com.intellij.openapi.project.Project)14 SyncMessagesStub (com.android.tools.idea.gradle.project.sync.messages.SyncMessagesStub)12 NotificationHyperlink (com.android.tools.idea.gradle.project.sync.hyperlink.NotificationHyperlink)11 PositionInFile (com.android.tools.idea.gradle.util.PositionInFile)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 AndroidProject (com.android.builder.model.AndroidProject)5 MessageType (com.android.tools.idea.gradle.project.sync.messages.MessageType)5 SyncMessages (com.android.tools.idea.gradle.project.sync.messages.SyncMessages)5 Sdk (com.intellij.openapi.projectRoots.Sdk)5 GradleVersion (com.android.ide.common.repository.GradleVersion)3 ProjectSubset (com.android.tools.idea.gradle.project.subset.ProjectSubset)3 ComponentVersionReader (com.android.tools.idea.gradle.project.sync.compatibility.version.ComponentVersionReader)3 ArrayList (java.util.ArrayList)3 NotNull (org.jetbrains.annotations.NotNull)3 Message (com.android.ide.common.blame.Message)2 AndroidVersion (com.android.sdklib.AndroidVersion)2 AndroidPluginVersionUpdater (com.android.tools.idea.gradle.plugin.AndroidPluginVersionUpdater)2 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)2