Ei kuvausta

Pods-PublicFund-resources.sh 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. # This protects against multiple targets copying the same framework dependency at the same time. The solution
  8. # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
  9. RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
  10. case "${TARGETED_DEVICE_FAMILY}" in
  11. 1,2)
  12. TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
  13. ;;
  14. 1)
  15. TARGET_DEVICE_ARGS="--target-device iphone"
  16. ;;
  17. 2)
  18. TARGET_DEVICE_ARGS="--target-device ipad"
  19. ;;
  20. 3)
  21. TARGET_DEVICE_ARGS="--target-device tv"
  22. ;;
  23. 4)
  24. TARGET_DEVICE_ARGS="--target-device watch"
  25. ;;
  26. *)
  27. TARGET_DEVICE_ARGS="--target-device mac"
  28. ;;
  29. esac
  30. install_resource()
  31. {
  32. if [[ "$1" = /* ]] ; then
  33. RESOURCE_PATH="$1"
  34. else
  35. RESOURCE_PATH="${PODS_ROOT}/$1"
  36. fi
  37. if [[ ! -e "$RESOURCE_PATH" ]] ; then
  38. cat << EOM
  39. error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
  40. EOM
  41. exit 1
  42. fi
  43. case $RESOURCE_PATH in
  44. *.storyboard)
  45. 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}" || true
  46. 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}
  47. ;;
  48. *.xib)
  49. 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}" || true
  50. 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}
  51. ;;
  52. *.framework)
  53. echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
  54. mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  55. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
  56. rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  57. ;;
  58. *.xcdatamodel)
  59. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
  60. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
  61. ;;
  62. *.xcdatamodeld)
  63. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
  64. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
  65. ;;
  66. *.xcmappingmodel)
  67. echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
  68. xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
  69. ;;
  70. *.xcassets)
  71. ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
  72. XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
  73. ;;
  74. *)
  75. echo "$RESOURCE_PATH" || true
  76. echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
  77. ;;
  78. esac
  79. }
  80. if [[ "$CONFIGURATION" == "Debug" ]]; then
  81. install_resource "${PODS_CONFIGURATION_BUILD_DIR}/FORScrollViewEmptyAssistant/FORScrollViewEmptyAssistant.bundle"
  82. install_resource "${PODS_ROOT}/IQKeyboardManager/IQKeyboardManager/Resources/IQKeyboardManager.bundle"
  83. install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
  84. install_resource "${PODS_ROOT}/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle"
  85. install_resource "${PODS_ROOT}/UMengUShare/UShareSDK/UMSocialSDK/UMSocialSDKPromptResources.bundle"
  86. install_resource "${PODS_ROOT}/UMengUShare/UShareSDK/UMSocialUI/UMSocialSDKResources.bundle"
  87. fi
  88. if [[ "$CONFIGURATION" == "Release" ]]; then
  89. install_resource "${PODS_CONFIGURATION_BUILD_DIR}/FORScrollViewEmptyAssistant/FORScrollViewEmptyAssistant.bundle"
  90. install_resource "${PODS_ROOT}/IQKeyboardManager/IQKeyboardManager/Resources/IQKeyboardManager.bundle"
  91. install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
  92. install_resource "${PODS_ROOT}/TZImagePickerController/TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle"
  93. install_resource "${PODS_ROOT}/UMengUShare/UShareSDK/UMSocialSDK/UMSocialSDKPromptResources.bundle"
  94. install_resource "${PODS_ROOT}/UMengUShare/UShareSDK/UMSocialUI/UMSocialSDKResources.bundle"
  95. fi
  96. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  97. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  98. if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  99. mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  100. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  101. fi
  102. rm -f "$RESOURCES_TO_COPY"
  103. if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
  104. then
  105. # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  106. OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  107. while read line; do
  108. if [[ $line != "${PODS_ROOT}*" ]]; then
  109. XCASSET_FILES+=("$line")
  110. fi
  111. done <<<"$OTHER_XCASSETS"
  112. 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}"
  113. fi