use of com.facebook.buck.apple.AppleBundleExtension in project buck by facebook.
the class ProjectGenerator method getDestinationSpec.
private Optional<CopyFilePhaseDestinationSpec> getDestinationSpec(TargetNode<?, ?> targetNode) {
if (targetNode.getDescription() instanceof AppleBundleDescription) {
AppleBundleDescription.Arg arg = (AppleBundleDescription.Arg) targetNode.getConstructorArg();
AppleBundleExtension extension = arg.extension.isLeft() ? arg.extension.getLeft() : AppleBundleExtension.BUNDLE;
switch(extension) {
case FRAMEWORK:
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.FRAMEWORKS));
case APPEX:
case PLUGIN:
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.PLUGINS));
case APP:
if (isWatchApplicationNode(targetNode)) {
return Optional.of(CopyFilePhaseDestinationSpec.builder().setDestination(PBXCopyFilesBuildPhase.Destination.PRODUCTS).setPath("$(CONTENTS_FOLDER_PATH)/Watch").build());
} else {
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.EXECUTABLES));
}
case BUNDLE:
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.PLUGINS));
//$CASES-OMITTED$
default:
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.PRODUCTS));
}
} else if (targetNode.getDescription() instanceof AppleLibraryDescription || targetNode.getDescription() instanceof CxxLibraryDescription) {
if (targetNode.getBuildTarget().getFlavors().contains(CxxDescriptionEnhancer.SHARED_FLAVOR)) {
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.FRAMEWORKS));
} else {
return Optional.empty();
}
} else if (targetNode.getDescription() instanceof AppleBinaryDescription) {
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.EXECUTABLES));
} else if (targetNode.getDescription() instanceof HalideLibraryDescription) {
return Optional.empty();
} else if (targetNode.getDescription() instanceof CoreDataModelDescription || targetNode.getDescription() instanceof SceneKitAssetsDescription) {
return Optional.of(CopyFilePhaseDestinationSpec.of(PBXCopyFilesBuildPhase.Destination.RESOURCES));
} else {
throw new RuntimeException("Unexpected type: " + targetNode.getDescription().getClass());
}
}
Aggregations