信贷产品

Pods-CreditAssistant-resources.sh 7.2KB

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