use of com.facebook.buck.rules.SourcePathRuleFinder in project buck by facebook.
the class AppleDescriptionsTest method parseAppleHeadersForUseFromTheSameTargetFromMap.
@Test
public void parseAppleHeadersForUseFromTheSameTargetFromMap() {
ImmutableSortedMap<String, SourcePath> headerMap = ImmutableSortedMap.of("virtual/path.h", new FakeSourcePath("path/to/some_file.h"), "another/path.h", new FakeSourcePath("path/to/another_file.h"), "another/file.h", new FakeSourcePath("different/path/to/a_file.h"), "file.h", new FakeSourcePath("file.h"));
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
assertEquals(ImmutableMap.of(), AppleDescriptions.parseAppleHeadersForUseFromTheSameTarget(resolver::getRelativePath, SourceList.ofNamedSources(headerMap)));
}
use of com.facebook.buck.rules.SourcePathRuleFinder in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromEntryMapsKeepsLongestCommonPrefix.
@Test
public void creatingGroupsFromEntryMapsKeepsLongestCommonPrefix() {
ImmutableMultimap<Path, String> subgroups = ImmutableMultimap.<Path, String>builder().put(Paths.get("root"), "Lib").put(Paths.get("root/Lib"), "Bar").put(Paths.get("root/Lib"), "Foo").build();
ImmutableMultimap<Path, GroupedSource> entries = ImmutableMultimap.<Path, GroupedSource>builder().put(Paths.get("root/Lib/Foo"), GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File2.h"))).put(Paths.get("root/Lib/Bar"), GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Bar/File1.h"))).put(Paths.get("root/Lib/Foo"), GroupedSource.ofPrivateHeader(new FakeSourcePath("Lib/Foo/File1.h"))).build();
ImmutableList<GroupedSource> expected = ImmutableList.of(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")))))));
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.SourcePathRuleFinder in project buck by facebook.
the class NewNativeTargetProjectMutatorTest method setUp.
@Before
public void setUp() {
assumeTrue(Platform.detect() == Platform.MACOS || Platform.detect() == Platform.LINUX);
generatedProject = new PBXProject("TestProject");
sourcePathResolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
pathRelativizer = new PathRelativizer(Paths.get("_output"), sourcePathResolver::getRelativePath);
}
use of com.facebook.buck.rules.SourcePathRuleFinder in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromNoSourcePaths.
@Test
public void creatingGroupsFromNoSourcePaths() {
ImmutableList<GroupedSource> expected = ImmutableList.of();
SourcePathResolver resolver = new SourcePathResolver(new SourcePathRuleFinder(new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())));
ImmutableList<GroupedSource> actual = RuleUtils.createGroupsFromSourcePaths(resolver::getRelativePath, ImmutableList.of(), ImmutableList.of(), ImmutableList.of(), ImmutableList.of());
assertEquals(expected, actual);
}
use of com.facebook.buck.rules.SourcePathRuleFinder 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);
}
Aggregations