use of com.facebook.buck.android.NdkLibraryBuilder in project buck by facebook.
the class ProjectTest method testNdkLibraryHasCorrectPath.
@Test
public void testNdkLibraryHasCorrectPath() throws Exception {
BuildRuleResolver ruleResolver = new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
// Build up a the graph that corresponds to:
//
// ndk_library(
// name = 'foo-jni'
// )
//
// project_config(
// src_target = ':foo-jni',
// )
ProjectFilesystem projectFilesystem = new FakeProjectFilesystem();
BuildTarget fooJni = BuildTargetFactory.newInstance("//third_party/java/foo/jni:foo-jni");
NdkLibrary ndkLibrary = new NdkLibraryBuilder(fooJni).build(ruleResolver, projectFilesystem);
ProjectConfig ndkProjectConfig = ProjectConfigBuilder.createBuilder(BuildTargetFactory.newInstance("//third_party/java/foo/jni:project_config")).setSrcRule(ndkLibrary.getBuildTarget()).build(ruleResolver);
ProjectWithModules projectWithModules = getModulesForActionGraph(ruleResolver, ImmutableSortedSet.of(ndkProjectConfig), null, /* javaPackageFinder */
null);
List<SerializableModule> modules = projectWithModules.modules;
assertEquals("Should be one module for the ndk_library.", 1, modules.size());
SerializableModule androidLibraryModule = Iterables.getOnlyElement(modules);
assertListEquals(ImmutableList.of(SerializableDependentModule.newSourceFolder(), SerializableDependentModule.newInheritedJdk()), androidLibraryModule.getDependencies());
assertEquals(Paths.get(String.format("../../../../%s", ndkLibrary.getLibraryPath())), androidLibraryModule.nativeLibs);
}
Aggregations