use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method do_changeDefines_testIncrementalUpdate.
private void do_changeDefines_testIncrementalUpdate(List<String> labelsToFlip, ReusedConfigurationExpectations expectation) {
ProjectView projectView = projectView(directories("foo/bar"), targets("//foo/bar:...:all"));
List<BlazeResolveConfiguration> configurations = resolve(projectView, incrementalUpdateTestCaseInitialTargetMap());
assertThat(configurations).hasSize(2);
assertThat(get(configurations, "//foo/bar:a and 2 other target(s)")).isNotNull();
assertThat(get(configurations, "//foo/bar:d")).isNotNull();
TargetMapBuilder targetMapBuilder = TargetMapBuilder.builder().addTarget(createCcToolchain());
for (String target : ImmutableList.of("a", "b", "c")) {
if (labelsToFlip.contains(target)) {
targetMapBuilder.addTarget(createCcTarget(String.format("//foo/bar:%s", target), Kind.CC_BINARY, sources(String.format("foo/bar/%s.cc", target)), defines("DIFFERENT=1"), includes()));
} else {
targetMapBuilder.addTarget(createCcTarget(String.format("//foo/bar:%s", target), Kind.CC_BINARY, sources(String.format("foo/bar/%s.cc", target)), defines("SAME=1"), includes()));
}
}
targetMapBuilder.addTarget(createCcTarget("//foo/bar:d", Kind.CC_BINARY, sources("foo/bar/d.cc"), defines("DIFFERENT=1"), includes()));
List<BlazeResolveConfiguration> newConfigurations = resolve(projectView, targetMapBuilder.build());
assertReusedConfigs(configurations, newConfigurations, expectation);
}
use of com.google.idea.blaze.base.projectview.ProjectView in project intellij by bazelbuild.
the class BlazeResolveConfigurationEquivalenceTest method testIncludes.
@Test
public void testIncludes() {
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(), includes("foo/same"))).addTarget(createCcTarget("//foo/bar:two", Kind.CC_BINARY, sources("foo/bar/two.cc"), defines(), includes("foo/same"))).addTarget(createCcTarget("//foo/bar:three", Kind.CC_BINARY, sources("foo/bar/three.cc"), defines(), includes("foo/different"))).build();
VirtualFile includeSame = createVirtualFile("/root/foo/same");
VirtualFile includeDifferent = createVirtualFile("/root/foo/different");
List<BlazeResolveConfiguration> configurations = resolve(projectView, targetMap);
assertThat(configurations).hasSize(2);
assertThat(getHeaders(get(configurations, "//foo/bar:one and 1 other target(s)"), OCLanguageKind.CPP)).containsExactly(header(includeSame));
assertThat(getHeaders(get(configurations, "//foo/bar:three"), OCLanguageKind.CPP)).containsExactly(header(includeDifferent));
for (BlazeResolveConfiguration configuration : configurations) {
assertThat(configuration.getProjectHeadersRoots().getRoots()).isEmpty();
assertThat(configuration.getCompilerMacros()).isEqualTo(macros());
}
}
Aggregations