No Description

Pods-WEIYAN-resources.sh 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/sh
  2. set -e
  3. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  4. RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
  5. > "$RESOURCES_TO_COPY"
  6. XCASSET_FILES=()
  7. case "${TARGETED_DEVICE_FAMILY}" in
  8. 1,2)
  9. TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
  10. ;;
  11. 1)
  12. TARGET_DEVICE_ARGS="--target-device iphone"
  13. ;;
  14. 2)
  15. TARGET_DEVICE_ARGS="--target-device ipad"
  16. ;;
  17. 3)
  18. TARGET_DEVICE_ARGS="--target-device tv"
  19. ;;
  20. 4)
  21. TARGET_DEVICE_ARGS="--target-device watch"
  22. ;;
  23. *)
  24. TARGET_DEVICE_ARGS="--target-device mac"
  25. ;;
  26. esac
  27. install_resource()
  28. {
  29. if [[ "$1" = /* ]] ; then
  30. RESOURCE_PATH="$1"
  31. else
  32. RESOURCE_PATH="${PODS_ROOT}/$1"
  33. fi
  34. if [[ ! -e "$RESOURCE_PATH" ]] ; then
  35. cat << EOM
  36. error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
  37. EOM
  38. exit 1
  39. fi
  40. case $RESOURCE_PATH in
  41. *.storyboard)
  42. echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
  43. ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
  44. ;;
  45. *.xib)
  46. echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
  47. ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
  48. ;;
  49. *.framework)
  50. echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  51. mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  52. echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  53. rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  54. ;;
  55. *.xcdatamodel)
  56. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
  57. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
  58. ;;
  59. *.xcdatamodeld)
  60. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
  61. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
  62. ;;
  63. *.xcmappingmodel)
  64. echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
  65. xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
  66. ;;
  67. *.xcassets)
  68. ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
  69. XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
  70. ;;
  71. *)
  72. echo "$RESOURCE_PATH"
  73. echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
  74. ;;
  75. esac
  76. }
  77. if [[ "$CONFIGURATION" == "Debug" ]]; then
  78. install_resource "$PODS_CONFIGURATION_BUILD_DIR/FORScrollViewEmptyAssistant/FORScrollViewEmptyAssistant.bundle"
  79. install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
  80. install_resource "$PODS_CONFIGURATION_BUILD_DIR/QBImagePickerController/QBImagePicker.bundle"
  81. fi
  82. if [[ "$CONFIGURATION" == "Release" ]]; then
  83. install_resource "$PODS_CONFIGURATION_BUILD_DIR/FORScrollViewEmptyAssistant/FORScrollViewEmptyAssistant.bundle"
  84. install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
  85. install_resource "$PODS_CONFIGURATION_BUILD_DIR/QBImagePickerController/QBImagePicker.bundle"
  86. fi
  87. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  88. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  89. if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  90. mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  91. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  92. fi
  93. rm -f "$RESOURCES_TO_COPY"
  94. if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
  95. then
  96. # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  97. OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  98. while read line; do
  99. if [[ $line != "${PODS_ROOT}*" ]]; then
  100. XCASSET_FILES+=("$line")
  101. fi
  102. done <<<"$OTHER_XCASSETS"
  103. printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  104. fi