Search in sources :

Example 76 with ProjectView

use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method identicalTargets_testIncrementalUpdateFullReuse.

@Test
public void identicalTargets_testIncrementalUpdateFullReuse() {
    ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:binary"));
    TargetMap targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:binary", Kind.CC_BINARY, ImmutableList.of(src("foo/bar/binary.cc")))).build();
    assertThatResolving(projectView, targetMap).producesConfigurationsFor("//foo/bar:binary");
    Collection<BlazeResolveConfiguration> initialConfigurations = resolverResult.getAllConfigurations();
    assertThatResolving(projectView, targetMap).reusedConfigurations(initialConfigurations);
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Example 77 with ProjectView

use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method newTarget_testIncrementalUpdatePartlyReused.

@Test
public void newTarget_testIncrementalUpdatePartlyReused() {
    ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:*"));
    TargetMapBuilder targetMapBuilder = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:binary", Kind.CC_BINARY, ImmutableList.of(src("foo/bar/binary.cc"))));
    assertThatResolving(projectView, targetMapBuilder.build()).producesConfigurationsFor("//foo/bar:binary");
    Collection<BlazeResolveConfiguration> initialConfigurations = resolverResult.getAllConfigurations();
    targetMapBuilder.addTarget(createCcTarget("//foo/bar:library", Kind.CC_LIBRARY, ImmutableList.of(src("foo/bar/library.cc")), ImmutableList.of("OTHER=1")));
    assertThatResolving(projectView, targetMapBuilder.build()).reusedConfigurations(initialConfigurations, "//foo/bar:library");
}
Also used : TargetMapBuilder(com.google.idea.blaze.base.ideinfo.TargetMapBuilder) ProjectView(com.google.idea.blaze.base.projectview.ProjectView) Test(org.junit.Test)

Example 78 with ProjectView

use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method brokenCompiler_collectsIssues.

@Test
public void brokenCompiler_collectsIssues() {
    ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:*"));
    TargetMap targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:binary", Kind.CC_BINARY, ImmutableList.of(src("foo/bar/binary.cc")))).build();
    createVirtualFile("/root/foo/bar/binary.cc");
    compilerVersionChecker.setInjectFault(true);
    computeResolverResult(projectView, targetMap);
    errorCollector.assertIssueContaining("Unable to determine version of compiler");
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Example 79 with ProjectView

use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method testTargetWithoutSources.

@Test
public void testTargetWithoutSources() {
    ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:library"));
    TargetMap targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:library", Kind.CC_LIBRARY, ImmutableList.of())).build();
    assertThatResolving(projectView, targetMap).producesNoConfigurations();
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Example 80 with ProjectView

use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method completelyDifferentTargetsSameProjectView_testIncrementalUpdateNoReuse.

@Test
public void completelyDifferentTargetsSameProjectView_testIncrementalUpdateNoReuse() {
    ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:*"));
    TargetMap targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:binary", Kind.CC_BINARY, ImmutableList.of(src("foo/bar/binary.cc")))).build();
    ImmutableList<BlazeResolveConfiguration> noReusedConfigurations = ImmutableList.of();
    assertThatResolving(projectView, targetMap).reusedConfigurations(noReusedConfigurations, "//foo/bar:binary");
    TargetMap targetMap2 = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:library", Kind.CC_LIBRARY, ImmutableList.of(src("foo/bar/library.cc")), ImmutableList.of("OTHER=1"))).build();
    assertThatResolving(projectView, targetMap2).reusedConfigurations(noReusedConfigurations, "//foo/bar:library");
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Aggregations

ProjectView (com.google.idea.blaze.base.projectview.ProjectView)87 Test (org.junit.Test)81 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)55 TargetMapBuilder (com.google.idea.blaze.base.ideinfo.TargetMapBuilder)45 BlazeJavaImportResult (com.google.idea.blaze.java.sync.model.BlazeJavaImportResult)40 TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)33 BlazeAndroidImportResult (com.google.idea.blaze.android.sync.model.BlazeAndroidImportResult)13 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)12 File (java.io.File)12 BlazeScalaImportResult (com.google.idea.blaze.scala.sync.model.BlazeScalaImportResult)9 DirectoryEntry (com.google.idea.blaze.base.projectview.section.sections.DirectoryEntry)8 AndroidAarIdeInfo (com.google.idea.blaze.base.ideinfo.AndroidAarIdeInfo)7 BlazeJarLibrary (com.google.idea.blaze.java.sync.model.BlazeJarLibrary)6 WorkingSet (com.google.idea.blaze.base.sync.workspace.WorkingSet)5 JavaWorkingSet (com.google.idea.blaze.java.sync.workingset.JavaWorkingSet)5 ImmutableList (com.google.common.collect.ImmutableList)4 GenfilesPath (com.google.idea.blaze.android.projectview.GenfilesPath)4 BlazeAndroidLibrarySource (com.google.idea.blaze.android.sync.BlazeAndroidLibrarySource)4 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)4 DirectorySection (com.google.idea.blaze.base.projectview.section.sections.DirectorySection)4