use of com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer 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.DefaultTargetNodeToBuildRuleTransformer 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.DefaultTargetNodeToBuildRuleTransformer 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.DefaultTargetNodeToBuildRuleTransformer 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.DefaultTargetNodeToBuildRuleTransformer in project buck by facebook.
the class RuleUtilsTest method creatingGroupsFromEmptyEntryMaps.
@Test
public void creatingGroupsFromEmptyEntryMaps() {
ImmutableMultimap<Path, String> subgroups = ImmutableMultimap.of();
ImmutableMultimap<Path, GroupedSource> entries = ImmutableMultimap.of();
ImmutableList<GroupedSource> expected = ImmutableList.of();
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