Search in sources :

Example 1 with CPrefetchFileSource

use of com.google.idea.blaze.cpp.CPrefetchFileSource in project intellij by bazelbuild.

the class CPrefetchFileSourceTest method testJavaSourceFilesIgnored.

@Test
public void testJavaSourceFilesIgnored() {
    ProjectViewSet projectViewSet = parseProjectView("directories:", "  java/com/google", "targets:", "  //java/com/google:lib", "additional_languages:", "  c", "android_sdk_platform: android-25");
    BlazeProjectData projectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).setTargetMap(TargetMapBuilder.builder().addTarget(TargetIdeInfo.builder().setBuildFile(sourceRoot("third_party/library/BUILD")).setLabel("//third_party/library:lib").setKind("java_library").addSource(sourceRoot("third_party/library/Library.java"))).build()).setWorkspaceLanguageSettings(LanguageSupport.createWorkspaceLanguageSettings(projectViewSet)).build();
    Set<File> filesToPrefetch = new HashSet<>();
    new CPrefetchFileSource().addFilesToPrefetch(getProject(), projectViewSet, getImportRoots(projectViewSet), projectData, filesToPrefetch);
    assertThat(filesToPrefetch).isEmpty();
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) CPrefetchFileSource(com.google.idea.blaze.cpp.CPrefetchFileSource) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 2 with CPrefetchFileSource

use of com.google.idea.blaze.cpp.CPrefetchFileSource in project intellij by bazelbuild.

the class CPrefetchFileSourceTest method testSourceFilesInProjectIgnored.

@Test
public void testSourceFilesInProjectIgnored() {
    ProjectViewSet projectViewSet = parseProjectView("directories:", "  java/com/google", "targets:", "  //java/com/google:lib", "additional_languages:", "  c", "android_sdk_platform: android-25");
    BlazeProjectData projectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).setTargetMap(TargetMapBuilder.builder().addTarget(TargetIdeInfo.builder().setBuildFile(sourceRoot("java/com/google/BUILD")).setLabel("//java/com/google:lib").setKind("cc_library").addSource(sourceRoot("java/com/google/native.cc")).addSource(sourceRoot("java/com/google/native.h"))).build()).setWorkspaceLanguageSettings(LanguageSupport.createWorkspaceLanguageSettings(projectViewSet)).build();
    Set<File> filesToPrefetch = new HashSet<>();
    new CPrefetchFileSource().addFilesToPrefetch(getProject(), projectViewSet, getImportRoots(projectViewSet), projectData, filesToPrefetch);
    assertThat(filesToPrefetch).isEmpty();
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) CPrefetchFileSource(com.google.idea.blaze.cpp.CPrefetchFileSource) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 3 with CPrefetchFileSource

use of com.google.idea.blaze.cpp.CPrefetchFileSource in project intellij by bazelbuild.

the class CPrefetchFileSourceTest method testCppHeaderFilesOutsideProjectIncluded.

@Test
public void testCppHeaderFilesOutsideProjectIncluded() {
    ProjectViewSet projectViewSet = parseProjectView("directories:", "  java/com/google", "targets:", "  //java/com/google:lib", "additional_languages:", "  c", "android_sdk_platform: android-25");
    BlazeProjectData projectData = MockBlazeProjectDataBuilder.builder(workspaceRoot).setTargetMap(TargetMapBuilder.builder().addTarget(TargetIdeInfo.builder().setBuildFile(sourceRoot("third_party/library/BUILD")).setLabel("//third_party/library:dep").setKind("cc_library").setCInfo(CIdeInfo.builder().addSource(sourceRoot("third_party/library/main.cc")).addHeader(sourceRoot("third_party/library/dep.h")).addHeader(sourceRoot("third_party/library/other.h")).addTextualHeader(sourceRoot("third_party/library/textual.h")))).build()).setWorkspaceLanguageSettings(LanguageSupport.createWorkspaceLanguageSettings(projectViewSet)).build();
    Set<File> filesToPrefetch = new HashSet<>();
    new CPrefetchFileSource().addFilesToPrefetch(getProject(), projectViewSet, getImportRoots(projectViewSet), projectData, filesToPrefetch);
    assertThat(filesToPrefetch).containsExactly(workspaceFile("third_party/library/dep.h"), workspaceFile("third_party/library/other.h"), workspaceFile("third_party/library/textual.h"));
}
Also used : ProjectViewSet(com.google.idea.blaze.base.projectview.ProjectViewSet) CPrefetchFileSource(com.google.idea.blaze.cpp.CPrefetchFileSource) BlazeProjectData(com.google.idea.blaze.base.model.BlazeProjectData) File(java.io.File) HashSet(java.util.HashSet) Test(org.junit.Test)

Aggregations

BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)3 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)3 CPrefetchFileSource (com.google.idea.blaze.cpp.CPrefetchFileSource)3 File (java.io.File)3 HashSet (java.util.HashSet)3 Test (org.junit.Test)3