use of com.facebook.buck.halide.HalideLibraryBuilder in project buck by facebook.
the class ProjectGeneratorTest method testHalideLibraryRule.
@Test
public void testHalideLibraryRule() throws IOException {
BuildTarget compilerTarget = BuildTarget.builder(rootPath, "//foo", "lib").addFlavors(HalideLibraryDescription.HALIDE_COMPILER_FLAVOR).build();
TargetNode<?, ?> compiler = new HalideLibraryBuilder(compilerTarget).setSrcs(ImmutableSortedSet.of(SourceWithFlags.of(new FakeSourcePath("main.cpp")), SourceWithFlags.of(new FakeSourcePath("filter.cpp")))).build();
BuildTarget libTarget = BuildTarget.builder(rootPath, "//foo", "lib").build();
TargetNode<?, ?> lib = new HalideLibraryBuilder(libTarget).build();
ProjectGenerator projectGenerator = createProjectGeneratorForCombinedProject(ImmutableSet.of(compiler, lib));
projectGenerator.createXcodeProjects();
PBXTarget target = assertTargetExistsAndReturnTarget(projectGenerator.getGeneratedProject(), "//foo:lib");
assertThat(target.isa(), equalTo("PBXNativeTarget"));
assertHasConfigurations(target, "Debug", "Release", "Profile");
assertEquals(1, target.getBuildPhases().size());
PBXShellScriptBuildPhase scriptPhase = ProjectGeneratorTestUtils.getSingletonPhaseByType(target, PBXShellScriptBuildPhase.class);
assertEquals(0, scriptPhase.getInputPaths().size());
assertEquals(0, scriptPhase.getOutputPaths().size());
// Note that we require that both the Halide "compiler" and the unflavored
// library target are present in the requiredBuildTargets, so that both the
// compiler and the generated header for the pipeline will be available for
// use by the Xcode compilation step.
ImmutableSet<BuildTarget> requiredBuildTargets = projectGenerator.getRequiredBuildTargets();
assertTrue(requiredBuildTargets.contains(compilerTarget));
assertThat(requiredBuildTargets, hasItem(libTarget.withFlavors(HalideLibraryDescription.HALIDE_COMPILE_FLAVOR, DEFAULT_PLATFORM.getFlavor())));
}
Aggregations