Search in sources :

Example 1 with HeaderSymlinkTreeWithHeaderMap

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"));
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) FakeBuildRuleParamsBuilder(com.facebook.buck.rules.FakeBuildRuleParamsBuilder) SourcePath(com.facebook.buck.rules.SourcePath) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) FakeCxxLibrary(com.facebook.buck.cxx.FakeCxxLibrary) BuildRuleParams(com.facebook.buck.rules.BuildRuleParams) BuildTarget(com.facebook.buck.model.BuildTarget) FakeBuildRule(com.facebook.buck.rules.FakeBuildRule) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) HeaderSymlinkTreeWithHeaderMap(com.facebook.buck.cxx.HeaderSymlinkTreeWithHeaderMap) Test(org.junit.Test)

Aggregations

FakeCxxLibrary (com.facebook.buck.cxx.FakeCxxLibrary)1 HeaderSymlinkTreeWithHeaderMap (com.facebook.buck.cxx.HeaderSymlinkTreeWithHeaderMap)1 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 BuildTarget (com.facebook.buck.model.BuildTarget)1 BuildRuleParams (com.facebook.buck.rules.BuildRuleParams)1 ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)1 FakeBuildRule (com.facebook.buck.rules.FakeBuildRule)1 FakeBuildRuleParamsBuilder (com.facebook.buck.rules.FakeBuildRuleParamsBuilder)1 SourcePath (com.facebook.buck.rules.SourcePath)1 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1