Search in sources :

Example 6 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testLineAfterTracebackIsAlsoParsed.

@Test
public void testLineAfterTracebackIsAlsoParsed() {
    String[] lines = new String[] { "ERROR: /home/plumpy/whatever:9:12: Traceback (most recent call last):", "\tFile \"/path/to/root/java/com/google/android/samples/helloroot/BUILD\", line 8", "\t\tpackage_group(name = BAD_FUNCTION(\"hellogoogle...\"), ...\"])", "\tFile \"/path/to/root/java/com/google/android/samples/helloroot/BUILD\", line 9, " + "in package_group", "\t\tBAD_FUNCTION", "name 'BAD_FUNCTION' is not defined." };
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    for (int i = 0; i < lines.length; ++i) {
        blazeIssueParser.parseIssue(lines[i]);
    }
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: /home/plumpy/whatever:char offsets 1222--1229: name 'grubber' is not defined");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/home/plumpy/whatever");
    assertThat(issue.getMessage()).isEqualTo("name 'grubber' is not defined");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 7 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testParseFileNotFoundErrorWithPackage.

@Test
public void testParseFileNotFoundErrorWithPackage() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: error loading package 'path/to/package': Extension file not found. Unable to" + " load file '//third_party/bazel:tools/ide/intellij_info.bzl': file doesn't exist" + " or isn't a file");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/root/third_party/bazel/tools/ide/intellij_info.bzl");
    assertThat(issue.getMessage()).isEqualTo("file doesn't exist or isn't a file");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 8 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testParseFileNotFoundError.

@Test
public void testParseFileNotFoundError() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: Extension file not found. Unable to load file '//third_party/bazel:tools/ide/" + "intellij_info.bzl': file doesn't exist or isn't a file");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/root/third_party/bazel/tools/ide/intellij_info.bzl");
    assertThat(issue.getMessage()).isEqualTo("file doesn't exist or isn't a file");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 9 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testParseBuildError.

@Test
public void testParseBuildError() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: /root/javatests/package_path/BUILD:42:12: " + "Target '//java/package_path:helloroot_visibility' failed");
    assertThat(issue).isNotNull();
    assertThat(issue.getFile().getPath()).isEqualTo("/root/javatests/package_path/BUILD");
    assertThat(issue.getLine()).isEqualTo(42);
    assertThat(issue.getColumn()).isEqualTo(12);
    assertThat(issue.getMessage()).isEqualTo("Target '//java/package_path:helloroot_visibility' failed");
    assertThat(issue.getCategory()).isEqualTo(IssueOutput.Category.ERROR);
    assertThat(issue.getConsoleHyperlinkRange()).isEqualTo(TextRange.create("ERROR: ".length(), "ERROR: /root/javatests/package_path/BUILD:42:12".length()));
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Example 10 with IssueOutput

use of com.google.idea.blaze.base.scope.output.IssueOutput in project intellij by bazelbuild.

the class BlazeIssueParserTest method testIgnoreExitCodeError.

@Test
public void testIgnoreExitCodeError() {
    BlazeIssueParser blazeIssueParser = new BlazeIssueParser(parsers);
    IssueOutput issue = blazeIssueParser.parseIssue("ERROR: //foo/bar:unit_tests: Exit 1.");
    assertThat(issue).isNull();
}
Also used : IssueOutput(com.google.idea.blaze.base.scope.output.IssueOutput) Test(org.junit.Test)

Aggregations

IssueOutput (com.google.idea.blaze.base.scope.output.IssueOutput)27 Test (org.junit.Test)19 Nullable (javax.annotation.Nullable)4 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)3 File (java.io.File)3 List (java.util.List)3 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)2 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)2 ProjectViewFile (com.google.idea.blaze.base.projectview.ProjectViewSet.ProjectViewFile)2 ProjectViewParser (com.google.idea.blaze.base.projectview.parser.ProjectViewParser)2 DirectoryEntry (com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry)2 Scope (com.google.idea.blaze.base.scope.Scope)2 BuildSystem (com.google.idea.blaze.base.settings.Blaze.BuildSystem)2 WorkspacePathResolver (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver)2 BlazeValidationError (com.google.idea.blaze.base.ui.BlazeValidationError)2 BlazeValidationResult (com.google.idea.blaze.base.ui.BlazeValidationResult)2 UiUtil (com.google.idea.blaze.base.ui.UiUtil)2 ProjectDataDirectoryValidator (com.google.idea.blaze.base.wizard2.ProjectDataDirectoryValidator)2 Disposable (com.intellij.openapi.Disposable)2 Logger (com.intellij.openapi.diagnostic.Logger)2