Search in sources :

Example 6 with AppleBundleDescription

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;
}
Also used : PBXTarget(com.facebook.buck.apple.xcode.xcodeproj.PBXTarget) AppleResourceDescription(com.facebook.buck.apple.AppleResourceDescription) TargetNode(com.facebook.buck.rules.TargetNode) CxxLibraryDescription(com.facebook.buck.cxx.CxxLibraryDescription) AppleNativeTargetDescriptionArg(com.facebook.buck.apple.AppleNativeTargetDescriptionArg) HalideLibraryDescription(com.facebook.buck.halide.HalideLibraryDescription) AppleTestDescription(com.facebook.buck.apple.AppleTestDescription) BuildTarget(com.facebook.buck.model.BuildTarget) UnflavoredBuildTarget(com.facebook.buck.model.UnflavoredBuildTarget) AppleNativeTargetDescriptionArg(com.facebook.buck.apple.AppleNativeTargetDescriptionArg) StringWithMacrosArg(com.facebook.buck.rules.args.StringWithMacrosArg) AppleWrapperResourceArg(com.facebook.buck.apple.AppleWrapperResourceArg) AppleBundleDescription(com.facebook.buck.apple.AppleBundleDescription) AppleBinaryDescription(com.facebook.buck.apple.AppleBinaryDescription) AppleLibraryDescription(com.facebook.buck.apple.AppleLibraryDescription)

Aggregations

AppleBundleDescription (com.facebook.buck.apple.AppleBundleDescription)6 AppleBinaryDescription (com.facebook.buck.apple.AppleBinaryDescription)4 AppleLibraryDescription (com.facebook.buck.apple.AppleLibraryDescription)4 CxxLibraryDescription (com.facebook.buck.cxx.CxxLibraryDescription)4 HalideLibraryDescription (com.facebook.buck.halide.HalideLibraryDescription)4 AppleNativeTargetDescriptionArg (com.facebook.buck.apple.AppleNativeTargetDescriptionArg)3 AppleTestDescription (com.facebook.buck.apple.AppleTestDescription)3 AppleWrapperResourceArg (com.facebook.buck.apple.AppleWrapperResourceArg)3 NSString (com.dd.plist.NSString)2 AppleResourceDescription (com.facebook.buck.apple.AppleResourceDescription)2 CoreDataModelDescription (com.facebook.buck.apple.CoreDataModelDescription)2 SceneKitAssetsDescription (com.facebook.buck.apple.SceneKitAssetsDescription)2 BuildTarget (com.facebook.buck.model.BuildTarget)2 UnflavoredBuildTarget (com.facebook.buck.model.UnflavoredBuildTarget)2 StringWithMacrosArg (com.facebook.buck.rules.args.StringWithMacrosArg)2 NSDictionary (com.dd.plist.NSDictionary)1 AndroidAarDescription (com.facebook.buck.android.AndroidAarDescription)1 AndroidBinaryDescription (com.facebook.buck.android.AndroidBinaryDescription)1 AndroidBuckConfig (com.facebook.buck.android.AndroidBuckConfig)1 AndroidBuildConfigDescription (com.facebook.buck.android.AndroidBuildConfigDescription)1