use of com.facebook.buck.rules.FakeSourcePath in project buck by facebook.
the class ProjectGeneratorTest method testAppleLibraryWithoutHeaderMaps.
@Test
public void testAppleLibraryWithoutHeaderMaps() throws IOException {
ImmutableSortedMap<String, ImmutableMap<String, String>> configs = ImmutableSortedMap.of("Debug", ImmutableMap.<String, String>of());
BuildTarget libraryTarget = BuildTarget.builder(rootPath, "//foo", "lib").build();
TargetNode<?, ?> libraryNode = AppleLibraryBuilder.createBuilder(libraryTarget).setConfigs(configs).setSrcs(ImmutableSortedSet.of(SourceWithFlags.of(new FakeSourcePath("foo.m")))).build();
BuildTarget testTarget = BuildTarget.builder(rootPath, "//foo", "xctest").build();
TargetNode<?, ?> testNode = AppleTestBuilder.createBuilder(testTarget).setConfigs(configs).setInfoPlist(new FakeSourcePath("Info.plist")).setSrcs(ImmutableSortedSet.of(SourceWithFlags.of(new FakeSourcePath("fooTest.m")))).setDeps(ImmutableSortedSet.of(libraryTarget)).build();
ProjectGenerator projectGenerator = createProjectGeneratorForCombinedProject(ImmutableSet.of(libraryNode, testNode), ImmutableSet.of(ProjectGenerator.Option.DISABLE_HEADER_MAPS));
projectGenerator.createXcodeProjects();
PBXTarget target = assertTargetExistsAndReturnTarget(projectGenerator.getGeneratedProject(), "//foo:xctest");
ImmutableMap<String, String> settings = getBuildSettings(testTarget, target, "Debug");
assertEquals("$(inherited) " + "../buck-out/gen/_p/ptQfVNNRRE-priv " + "../buck-out/gen/_p/ptQfVNNRRE-pub " + "../buck-out/gen/_p/CwkbTNOBmb-pub " + "../buck-out", settings.get("HEADER_SEARCH_PATHS"));
}
use of com.facebook.buck.rules.FakeSourcePath in project buck by facebook.
the class ProjectGeneratorTest method testSceneKitAssetsRuleAddsReference.
@Test
public void testSceneKitAssetsRuleAddsReference() throws IOException {
BuildTarget target = BuildTarget.builder(rootPath, "//foo", "scenekitasset").build();
TargetNode<?, ?> node = SceneKitAssetsBuilder.createBuilder(target).setPath(new FakeSourcePath("foo.scnassets").getRelativePath()).build();
testRuleAddsReference(target, node, "foo.scnassets");
}
use of com.facebook.buck.rules.FakeSourcePath in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromSingleFileEntryMaps.
@Test
public void creatingGroupsFromSingleFileEntryMaps() {
ImmutableMultimap<Path, String> subgroups = ImmutableMultimap.of();
ImmutableMultimap<Path, GroupedSource> entries = ImmutableMultimap.of(Paths.get("root"), GroupedSource.ofPrivateHeader(new FakeSourcePath("File1.h")));
ImmutableList<GroupedSource> expected = ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("File1.h")));
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
ImmutableList<GroupedSource> actual = RuleUtils.createGroupsFromEntryMaps(subgroups, entries, new RuleUtils.GroupedSourceNameComparator(resolver::getRelativePath), Paths.get("root"), Paths.get("root"));
assertEquals(expected, actual);
}
use of com.facebook.buck.rules.FakeSourcePath in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromSourcePathsRemovesLongestCommonPrefix.
@Test
public void creatingGroupsFromSourcePathsRemovesLongestCommonPrefix() {
ImmutableList<SourcePath> input = ImmutableList.of(new FakeSourcePath("Lib/Foo/File1.h"), new FakeSourcePath("Lib/Foo/File2.h"), new FakeSourcePath("Lib/Bar/File1.h"));
ImmutableList<GroupedSource> expected = ImmutableList.of(GroupedSource.ofSourceGroup("Bar", Paths.get("Lib/Bar"), ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Bar/File1.h")))), GroupedSource.ofSourceGroup("Foo", Paths.get("Lib/Foo"), ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File1.h")), GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File2.h")))));
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
ImmutableList<GroupedSource> actual = RuleUtils.createGroupsFromSourcePaths(resolver::getRelativePath, ImmutableList.of(), ImmutableSortedSet.of(), ImmutableList.of(), input);
assertEquals(expected, actual);
}
use of com.facebook.buck.rules.FakeSourcePath in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromSourcePaths.
@Test
public void creatingGroupsFromSourcePaths() {
ImmutableList<SourcePath> input = ImmutableList.of(new FakeSourcePath("File.h"), new FakeSourcePath("Lib/Foo/File2.h"), new FakeSourcePath("App/Foo/File.h"), new FakeSourcePath("Lib/Bar/File1.h"), new FakeSourcePath("App/File.h"), new FakeSourcePath("Lib/Foo/File1.h"), new FakeSourcePath("App/Foo/Bar/File.h"));
ImmutableList<GroupedSource> expected = ImmutableList.of(GroupedSource.ofSourceGroup("App", Paths.get("App"), ImmutableList.of(GroupedSource.ofSourceGroup("Foo", Paths.get("App/Foo"), ImmutableList.of(GroupedSource.ofSourceGroup("Bar", Paths.get("App/Foo/Bar"), ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("App/Foo/Bar/File.h")))), GroupedSource.ofPrivateHeader(new FakeSourcePath("App/Foo/File.h")))), GroupedSource.ofPrivateHeader(new FakeSourcePath("App/File.h")))), GroupedSource.ofSourceGroup("Lib", Paths.get("Lib"), ImmutableList.of(GroupedSource.ofSourceGroup("Bar", Paths.get("Lib/Bar"), ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Bar/File1.h")))), GroupedSource.ofSourceGroup("Foo", Paths.get("Lib/Foo"), ImmutableList.of(GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File1.h")), GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File2.h")))))), GroupedSource.ofPrivateHeader(new FakeSourcePath("File.h")));
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
ImmutableList<GroupedSource> actual = RuleUtils.createGroupsFromSourcePaths(resolver::getRelativePath, ImmutableList.of(), ImmutableSortedSet.of(), ImmutableList.of(), input);
assertEquals(expected, actual);
}
Aggregations