use of com.facebook.buck.cxx.HeaderSymlinkTreeWithHeaderMap in project buck by facebook.
the class SwiftLibraryIntegrationTest method headersOfDependentTargetsAreIncluded.
@Test
public void headersOfDependentTargetsAreIncluded() throws Exception {
// The output path used by the buildable for the link tree.
BuildTarget symlinkTarget = BuildTargetFactory.newInstance("//:symlink");
ProjectFilesystem projectFilesystem = new FakeProjectFilesystem(tmpDir.getRoot());
Path symlinkTreeRoot = BuildTargets.getGenPath(projectFilesystem, symlinkTarget, "%s/symlink-tree-root");
// Setup the map representing the link tree.
ImmutableMap<Path, SourcePath> links = ImmutableMap.of();
HeaderSymlinkTreeWithHeaderMap symlinkTreeBuildRule = HeaderSymlinkTreeWithHeaderMap.create(symlinkTarget, projectFilesystem, symlinkTreeRoot, links, ruleFinder);
resolver.addToIndex(symlinkTreeBuildRule);
BuildTarget libTarget = BuildTargetFactory.newInstance("//:lib");
BuildRuleParams libParams = new FakeBuildRuleParamsBuilder(libTarget).build();
FakeCxxLibrary depRule = new FakeCxxLibrary(libParams, BuildTargetFactory.newInstance("//:header"), symlinkTarget, BuildTargetFactory.newInstance("//:privateheader"), BuildTargetFactory.newInstance("//:privatesymlink"), new FakeBuildRule("//:archive", pathResolver), new FakeBuildRule("//:shared", pathResolver), Paths.get("output/path/lib.so"), "lib.so", ImmutableSortedSet.of());
BuildTarget buildTarget = BuildTargetFactory.newInstance("//foo:bar#iphoneos-x86_64");
BuildRuleParams params = new FakeBuildRuleParamsBuilder(buildTarget).setDeclaredDeps(ImmutableSortedSet.of(depRule)).build();
SwiftLibraryDescription.Arg args = createDummySwiftArg();
SwiftCompile buildRule = (SwiftCompile) FakeAppleRuleDescriptions.SWIFT_LIBRARY_DESCRIPTION.createBuildRule(TargetGraph.EMPTY, params, resolver, args);
ImmutableList<String> swiftIncludeArgs = buildRule.getSwiftIncludeArgs(pathResolver);
assertThat(swiftIncludeArgs.size(), Matchers.equalTo(1));
assertThat(swiftIncludeArgs.get(0), Matchers.startsWith("-I"));
assertThat(swiftIncludeArgs.get(0), Matchers.endsWith("symlink.hmap"));
}
Aggregations