Search in sources :

Example 71 with WorkspacePath

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

the class TestTargetSourcesHeuristicTest method testPredicateNoSources.

@Test
public void testPredicateNoSources() {
    File source = workspaceRoot.fileForPath(new WorkspacePath("java/com/foo/FooTest.java"));
    TargetInfo target = TargetIdeInfo.builder().setLabel("//foo:test").setKind("java_test").build().toTargetInfo();
    assertThat(new TestTargetSourcesHeuristic().matchesSource(project, target, null, source, null)).isFalse();
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) TargetInfo(com.google.idea.blaze.base.dependencies.TargetInfo) File(java.io.File) Test(org.junit.Test)

Example 72 with WorkspacePath

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

the class BuildTargetFinderTest method buildFileFindsSelf.

@Test
public void buildFileFindsSelf() {
    BuildTargetFinder buildTargetFinder = buildTargetFinder(ImmutableList.of(new WorkspacePath(".")));
    fileOperationProvider.addFiles(new File("/root/j/c/g/some/BUILD"), new File("/root/j/c/g/BUILD"));
    assertThat(buildTargetFinder.findTargetForFile(new File("/root/j/c/g/some/BUILD"))).isEqualTo(TargetExpression.fromStringSafe("//j/c/g/some:all"));
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) File(java.io.File) Test(org.junit.Test)

Example 73 with WorkspacePath

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

the class BuildTargetFinderTest method firstBuildFileInDirectoryIsFound.

@Test
public void firstBuildFileInDirectoryIsFound() {
    BuildTargetFinder buildTargetFinder = buildTargetFinder(ImmutableList.of(new WorkspacePath(".")));
    fileOperationProvider.addFiles(new File("/root/j/c/g/some/BUILD"), new File("/root/j/c/g/BUILD"), new File("/root/j/c/g/some/dir/File.java"));
    assertThat(buildTargetFinder.findTargetForFile(new File("/root/j/c/g/some/dir/File.java"))).isEqualTo(TargetExpression.fromStringSafe("//j/c/g/some:all"));
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) File(java.io.File) Test(org.junit.Test)

Example 74 with WorkspacePath

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

the class BuildFileTypeTest method testSkylarkExtensionRecognized.

@Test
public void testSkylarkExtensionRecognized() {
    PsiFile file = workspace.createPsiFile(new WorkspacePath("java/com/google/foo/build_defs.bzl"));
    assertThat(file).isInstanceOf(BuildFile.class);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) PsiFile(com.intellij.psi.PsiFile) Test(org.junit.Test)

Example 75 with WorkspacePath

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

the class BuildFileTypeTest method testExactNameMatch.

@Test
public void testExactNameMatch() {
    PsiFile file = workspace.createPsiFile(new WorkspacePath("java/com/google/foo/BUILD"));
    assertThat(file).isInstanceOf(BuildFile.class);
}
Also used : WorkspacePath(com.google.idea.blaze.base.model.primitives.WorkspacePath) PsiFile(com.intellij.psi.PsiFile) 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