use of com.facebook.buck.apple.AppleBundleDescription in project buck by facebook.
the class ProjectGenerator method generateProjectTarget.
@SuppressWarnings("unchecked")
private Optional<PBXTarget> generateProjectTarget(TargetNode<?, ?> targetNode) throws IOException {
Preconditions.checkState(isBuiltByCurrentProject(targetNode.getBuildTarget()), "should not generate rule if it shouldn't be built by current project");
Optional<PBXTarget> result = Optional.empty();
if (targetNode.getDescription() instanceof AppleLibraryDescription) {
result = Optional.of(generateAppleLibraryTarget(project, (TargetNode<AppleNativeTargetDescriptionArg, ?>) targetNode, Optional.empty()));
} else if (targetNode.getDescription() instanceof CxxLibraryDescription) {
result = Optional.of(generateCxxLibraryTarget(project, (TargetNode<CxxLibraryDescription.Arg, ?>) targetNode, ImmutableSet.of(), ImmutableSet.of(), Optional.empty()));
} else if (targetNode.getDescription() instanceof AppleBinaryDescription) {
result = Optional.of(generateAppleBinaryTarget(project, (TargetNode<AppleNativeTargetDescriptionArg, ?>) targetNode));
} else if (targetNode.getDescription() instanceof AppleBundleDescription) {
TargetNode<AppleBundleDescription.Arg, ?> bundleTargetNode = (TargetNode<AppleBundleDescription.Arg, ?>) targetNode;
result = Optional.of(generateAppleBundleTarget(project, bundleTargetNode, (TargetNode<AppleNativeTargetDescriptionArg, ?>) targetGraph.get(bundleTargetNode.getConstructorArg().binary), Optional.empty()));
} else if (targetNode.getDescription() instanceof AppleTestDescription) {
result = Optional.of(generateAppleTestTarget((TargetNode<AppleTestDescription.Arg, ?>) targetNode));
} else if (targetNode.getDescription() instanceof AppleResourceDescription) {
checkAppleResourceTargetNodeReferencingValidContents((TargetNode<AppleResourceDescription.Arg, ?>) targetNode);
} else if (targetNode.getDescription() instanceof HalideLibraryDescription) {
TargetNode<HalideLibraryDescription.Arg, ?> halideTargetNode = (TargetNode<HalideLibraryDescription.Arg, ?>) targetNode;
BuildTarget buildTarget = targetNode.getBuildTarget();
// The generated target just runs a shell script that invokes the "compiler" with the
// correct target architecture.
result = generateHalideLibraryTarget(project, halideTargetNode);
// Make sure the compiler gets built at project time, since we'll need
// it to generate the shader code during the Xcode build.
requiredBuildTargetsBuilder.add(HalideLibraryDescription.createHalideCompilerBuildTarget(buildTarget));
// headers from.
if (HalideLibraryDescription.isPlatformSupported(halideTargetNode.getConstructorArg(), defaultCxxPlatform)) {
// Run the compiler once at project time to generate the header
// file needed for compilation if the Halide target is for the default
// platform.
requiredBuildTargetsBuilder.add(buildTarget.withFlavors(HalideLibraryDescription.HALIDE_COMPILE_FLAVOR, defaultCxxPlatform.getFlavor()));
}
}
buckEventBus.post(ProjectGenerationEvent.processed());
return result;
}
Aggregations