Search in sources :

Example 61 with TargetMap

use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method testSingleSourceTargetWithLibraryDependencies.

@Test
public void testSingleSourceTargetWithLibraryDependencies() {
    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"))).addDependency("//bar/baz:library").addDependency("//third_party:library")).addTarget(createCcTarget("//bar/baz:library", Kind.CC_LIBRARY, ImmutableList.of(src("bar/baz/library.cc")))).addTarget(createCcTarget("//third_party:library", Kind.CC_LIBRARY, ImmutableList.of(src("third_party/library.cc")))).build();
    assertThatResolving(projectView, targetMap).producesConfigurationsFor("//foo/bar:binary");
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Example 62 with TargetMap

use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.

the class BlazeConfigurationResolverTest method firstResolve_testNotIncremental.

@Test
public void firstResolve_testNotIncremental() {
    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();
    ImmutableList<BlazeResolveConfiguration> noReusedConfigurations = ImmutableList.of();
    assertThatResolving(projectView, targetMap).reusedConfigurations(noReusedConfigurations, "//foo/bar:binary");
}
Also used : ProjectView(com.google.idea.blaze.base.projectview.ProjectView) TargetMap(com.google.idea.blaze.base.ideinfo.TargetMap) Test(org.junit.Test)

Example 63 with TargetMap

use of com.google.idea.blaze.base.ideinfo.TargetMap 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 64 with TargetMap

use of com.google.idea.blaze.base.ideinfo.TargetMap 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 65 with TargetMap

use of com.google.idea.blaze.base.ideinfo.TargetMap 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)

Aggregations

TargetMap (com.google.idea.blaze.base.ideinfo.TargetMap)77 Test (org.junit.Test)56 ProjectView (com.google.idea.blaze.base.projectview.ProjectView)33 BlazeProjectData (com.google.idea.blaze.base.model.BlazeProjectData)27 WorkspacePath (com.google.idea.blaze.base.model.primitives.WorkspacePath)26 WorkspaceLanguageSettings (com.google.idea.blaze.base.sync.projectview.WorkspaceLanguageSettings)17 TargetKey (com.google.idea.blaze.base.ideinfo.TargetKey)16 TargetIdeInfo (com.google.idea.blaze.base.ideinfo.TargetIdeInfo)15 ProjectViewSet (com.google.idea.blaze.base.projectview.ProjectViewSet)12 TargetMapBuilder (com.google.idea.blaze.base.ideinfo.TargetMapBuilder)11 ArtifactLocationDecoder (com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder)11 ArtifactLocation (com.google.idea.blaze.base.ideinfo.ArtifactLocation)10 BlazeSyncParams (com.google.idea.blaze.base.sync.BlazeSyncParams)10 BlazeScalaImportResult (com.google.idea.blaze.scala.sync.model.BlazeScalaImportResult)10 File (java.io.File)10 MockBlazeProjectDataManager (com.google.idea.blaze.base.model.MockBlazeProjectDataManager)9 BlazeJavaImportResult (com.google.idea.blaze.java.sync.model.BlazeJavaImportResult)9 ImmutableList (com.google.common.collect.ImmutableList)8 WorkspaceRoot (com.google.idea.blaze.base.model.primitives.WorkspaceRoot)8 ImmutableSet (com.google.common.collect.ImmutableSet)7