Search in sources :

Example 56 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class LoadStatementAnnotatorTest method testWarningForDeprecatedFormat.

@Test
public void testWarningForDeprecatedFormat() {
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('/tools/ide/build_test.bzl', 'build_test')");
    assertHasAnnotation(file, "Deprecated load syntax; loaded Skylark module should by in label format.", HighlightSeverity.WARNING);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 57 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class LoadStatementAnnotatorTest method testNoWarningsInExternalLoad.

@Test
public void testNoWarningsInExternalLoad() {
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('@tools//ide:build_test.bzl', 'build_test')");
    assertNoAnnotations(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 58 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class LoadStatementAnnotatorTest method testNoWarningsInNormalLoad.

@Test
public void testNoWarningsInNormalLoad() {
    BuildFile file = createBuildFile(new WorkspacePath("java/com/google/BUILD"), "load('//tools/ide/build_test.bzl', 'build_test')", "load(':local_file.bzl', 'symbol')");
    assertNoAnnotations(file);
}
Also used : BuildFile(com.google.idea.blaze.base.lang.buildfile.psi.BuildFile) WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 59 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class ProjectViewCompletionTest method testNonDirectoriesIncludedForSectionsAcceptingFiles.

@Test
public void testNonDirectoriesIncludedForSectionsAcceptingFiles() {
    setInput("import java<caret>");
    workspace.createFile(new WorkspacePath("java/.blazeproject"));
    String[] completionItems = editorTest.getCompletionItemsAsStrings();
    assertThat(completionItems).isNull();
    assertResult("import java/.blazeproject<caret>");
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Test(org.junit.Test)

Example 60 with WorkspacePath

use of com.google.idea.blaze.base.model.primitives.WorkspacePath in project intellij by bazelbuild.

the class ProjectViewSetTest method testProjectViewSetSerializable.

@Test
public void testProjectViewSetSerializable() throws Exception {
    ProjectViewSet projectViewSet = ProjectViewSet.builder().add(ProjectView.builder().add(ListSection.builder(DirectorySection.KEY).add(DirectoryEntry.include(new WorkspacePath("test")))).add(ListSection.builder(TargetSection.KEY).add(TargetExpression.fromStringSafe("//test:all"))).add(ScalarSection.builder(ImportSection.KEY).set(new WorkspacePath("test"))).add(ListSection.builder(TestSourceSection.KEY).add(new Glob("javatests/*"))).add(ListSection.builder(ExcludedSourceSection.KEY).add(new Glob("*.java"))).add(ListSection.builder(BuildFlagsSection.KEY).add("--android_sdk=abcd")).add(ListSection.builder(SyncFlagsSection.KEY).add("--config=arm")).add(ListSection.builder(ImportTargetOutputSection.KEY).add(Label.create("//test:test"))).add(ListSection.builder(ExcludeTargetSection.KEY).add(Label.create("//test:test"))).add(ScalarSection.builder(WorkspaceTypeSection.KEY).set(WorkspaceType.JAVA)).add(ListSection.builder(AdditionalLanguagesSection.KEY).add(LanguageClass.JAVA)).add(TextBlockSection.of(TextBlock.newLine())).add(ListSection.builder(RunConfigurationsSection.KEY).add(new WorkspacePath("test"))).add(ScalarSection.builder(ShardBlazeBuildsSection.KEY).set(false)).add(ScalarSection.builder(TargetShardSizeSection.KEY).set(500)).build()).build();
    // Assert we have all sections
    assert projectViewSet.getTopLevelProjectViewFile() != null;
    ProjectView projectView = projectViewSet.getTopLevelProjectViewFile().projectView;
    for (SectionParser parser : Sections.getParsers()) {
        ImmutableList<Section<?>> sections = projectView.getSections();
        assertThat(sections.stream().anyMatch(section -> section.isSectionType(parser.getSectionKey()))).isTrue();
    }
    TestUtils.assertIsSerializable(projectViewSet);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) Glob(com.google.idea.blaze.base.projectview.section.Glob) RunConfigurationsSection(com.google.idea.blaze.base.projectview.section.sections.RunConfigurationsSection) TargetShardSizeSection(com.google.idea.blaze.base.projectview.section.sections.TargetShardSizeSection) ImportTargetOutputSection(com.google.idea.blaze.base.projectview.section.sections.ImportTargetOutputSection) ScalarSection(com.google.idea.blaze.base.projectview.section.ScalarSection) ExcludeTargetSection(com.google.idea.blaze.base.projectview.section.sections.ExcludeTargetSection) DirectorySection(com.google.idea.blaze.base.projectview.section.sections.DirectorySection) TextBlockSection(com.google.idea.blaze.base.projectview.section.sections.TextBlockSection) ShardBlazeBuildsSection(com.google.idea.blaze.base.projectview.section.sections.ShardBlazeBuildsSection) AdditionalLanguagesSection(com.google.idea.blaze.base.projectview.section.sections.AdditionalLanguagesSection) WorkspaceTypeSection(com.google.idea.blaze.base.projectview.section.sections.WorkspaceTypeSection) SyncFlagsSection(com.google.idea.blaze.base.projectview.section.sections.SyncFlagsSection) TestSourceSection(com.google.idea.blaze.base.projectview.section.sections.TestSourceSection) TargetSection(com.google.idea.blaze.base.projectview.section.sections.TargetSection) Section(com.google.idea.blaze.base.projectview.section.Section) ImportSection(com.google.idea.blaze.base.projectview.section.sections.ImportSection) BuildFlagsSection(com.google.idea.blaze.base.projectview.section.sections.BuildFlagsSection) ListSection(com.google.idea.blaze.base.projectview.section.ListSection) ExcludedSourceSection(com.google.idea.blaze.base.projectview.section.sections.ExcludedSourceSection) SectionParser(com.google.idea.blaze.base.projectview.section.SectionParser) Test(org.junit.Test)

Aggregations

WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)509 Test (org.junit.Test)454 BuildFile (com.google.idea.blaze.base.lang.buildfile.psi.BuildFile)197 PsiFile (com.intellij.psi.PsiFile)84 File (java.io.File)75 ProjectView (com.google.idea.blaze.base.projectview.ProjectView)53 TargetMapBuilder (com.google.idea.blaze.base.ideinfo.TargetMapBuilder)48 Editor (com.intellij.openapi.editor.Editor)46 VirtualFile (com.intellij.openapi.vfs.VirtualFile)41 BlazeJavaImportResult (com.google.idea.blaze.java.sync.model.BlazeJavaImportResult)40 FuncallExpression (com.google.idea.blaze.base.lang.buildfile.psi.FuncallExpression)37 PsiReference (com.intellij.psi.PsiReference)37 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)34 ConfigurationContext (com.intellij.execution.actions.ConfigurationContext)34 BlazeContentEntry (com.google.idea.blaze.java.sync.model.BlazeContentEntry)33 BlazeCommandRunConfiguration (com.google.idea.blaze.base.run.BlazeCommandRunConfiguration)29 MockBlazeProjectDataBuilder (com.google.idea.blaze.base.model.MockBlazeProjectDataBuilder)26 ImportRoots (com.google.idea.blaze.base.sync.projectview.ImportRoots)26 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)25 PsiElement (com.intellij.psi.PsiElement)25