use of com.google.idea.blaze.base.ideinfo.TargetMap 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");
}
use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.
the class BlazeConfigurationResolverTest method completelyDifferentTargetsDifferentProjectView_testIncrementalUpdateNoReuse.
@Test
public void completelyDifferentTargetsDifferentProjectView_testIncrementalUpdateNoReuse() {
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");
ProjectView projectView2 = projectView(directories("foo/zoo"), targets("//foo/zoo:library"));
TargetMap targetMap2 = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/zoo:library", Kind.CC_LIBRARY, ImmutableList.of(src("foo/zoo/library.cc")), ImmutableList.of("OTHER=1"))).build();
assertThatResolving(projectView2, targetMap2).reusedConfigurations(noReusedConfigurations, "//foo/zoo:library");
}
use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method changeDefinesWithSameStructure_testIncrementalUpdate.
@Test
public void changeDefinesWithSameStructure_testIncrementalUpdate() {
ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:...:all"));
TargetMap targetMap = incrementalUpdateTestCaseInitialTargetMap();
List<BlazeResolveConfiguration> configurations = resolve(projectView, targetMap);
assertThat(configurations).hasSize(2);
assertThat(get(configurations, "//foo/bar:a and 2 other target(s)")).isNotNull();
assertThat(get(configurations, "//foo/bar:d")).isNotNull();
targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:a", Kind.CC_BINARY, sources("foo/bar/a.cc"), defines("CHANGED=1"), includes())).addTarget(createCcTarget("//foo/bar:b", Kind.CC_BINARY, sources("foo/bar/b.cc"), defines("CHANGED=1"), includes())).addTarget(createCcTarget("//foo/bar:c", Kind.CC_BINARY, sources("foo/bar/c.cc"), defines("CHANGED=1"), includes())).addTarget(createCcTarget("//foo/bar:d", Kind.CC_BINARY, sources("foo/bar/d.cc"), defines("DIFFERENT=1"), includes())).build();
List<BlazeResolveConfiguration> newConfigurations = resolve(projectView, targetMap);
assertThat(newConfigurations).hasSize(2);
assertReusedConfigs(configurations, newConfigurations, new ReusedConfigurationExpectations(ImmutableList.of("//foo/bar:d"), ImmutableList.of("//foo/bar:a and 2 other target(s)")));
}
use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method testDefines.
@Test
public void testDefines() {
ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:one", "//foo/bar:two", "//foo/bar:three"));
TargetMap targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:one", Kind.CC_BINARY, sources("foo/bar/one.cc"), defines("SAME=1"), includes())).addTarget(createCcTarget("//foo/bar:two", Kind.CC_BINARY, sources("foo/bar/two.cc"), defines("SAME=1"), includes())).addTarget(createCcTarget("//foo/bar:three", Kind.CC_BINARY, sources("foo/bar/three.cc"), defines("DIFFERENT=1"), includes())).build();
List<BlazeResolveConfiguration> configurations = resolve(projectView, targetMap);
assertThat(configurations).hasSize(2);
assertThat(get(configurations, "//foo/bar:one and 1 other target(s)").getCompilerMacros()).isEqualTo(macros("SAME=1"));
assertThat(get(configurations, "//foo/bar:three").getCompilerMacros()).isEqualTo(macros("DIFFERENT=1"));
for (BlazeResolveConfiguration configuration : configurations) {
assertThat(configuration.getProjectHeadersRoots().getRoots()).isEmpty();
assertThat(getHeaders(configuration, OCLanguageKind.CPP)).isEmpty();
}
}
use of com.google.idea.blaze.base.ideinfo.TargetMap in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method changeDefinesMakeAllSame_testIncrementalUpdate.
@Test
public void changeDefinesMakeAllSame_testIncrementalUpdate() {
ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:...:all"));
TargetMap targetMap = incrementalUpdateTestCaseInitialTargetMap();
List<BlazeResolveConfiguration> configurations = resolve(projectView, targetMap);
assertThat(configurations).hasSize(2);
assertThat(get(configurations, "//foo/bar:a and 2 other target(s)")).isNotNull();
assertThat(get(configurations, "//foo/bar:d")).isNotNull();
targetMap = TargetMapBuilder.builder().addTarget(createCcToolchain()).addTarget(createCcTarget("//foo/bar:a", Kind.CC_BINARY, sources("foo/bar/a.cc"), defines("SAME=1"), includes())).addTarget(createCcTarget("//foo/bar:b", Kind.CC_BINARY, sources("foo/bar/b.cc"), defines("SAME=1"), includes())).addTarget(createCcTarget("//foo/bar:c", Kind.CC_BINARY, sources("foo/bar/c.cc"), defines("SAME=1"), includes())).addTarget(createCcTarget("//foo/bar:d", Kind.CC_BINARY, sources("foo/bar/d.cc"), defines("SAME=1"), includes())).build();
List<BlazeResolveConfiguration> newConfigurations = resolve(projectView, targetMap);
assertThat(newConfigurations).hasSize(1);
// What used to be "//foo/bar:a and 2 other target(s)" will be renamed to
// "//foo/bar:a and 3 other target(s)" and reused.
assertReusedConfigs(configurations, newConfigurations, new ReusedConfigurationExpectations(ImmutableList.of("//foo/bar:a and 3 other target(s)"), ImmutableList.of()));
}
Aggregations