Pods-KulexiuForStudent-resources.sh 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #!/bin/sh
  2. set -e
  3. set -u
  4. set -o pipefail
  5. function on_error {
  6. echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
  7. }
  8. trap 'on_error $LINENO' ERR
  9. if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
  10. # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
  11. # resources to, so exit 0 (signalling the script phase was successful).
  12. exit 0
  13. fi
  14. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  15. RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
  16. > "$RESOURCES_TO_COPY"
  17. XCASSET_FILES=()
  18. # This protects against multiple targets copying the same framework dependency at the same time. The solution
  19. # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
  20. RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
  21. case "${TARGETED_DEVICE_FAMILY:-}" in
  22. 1,2)
  23. TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
  24. ;;
  25. 1)
  26. TARGET_DEVICE_ARGS="--target-device iphone"
  27. ;;
  28. 2)
  29. TARGET_DEVICE_ARGS="--target-device ipad"
  30. ;;
  31. 3)
  32. TARGET_DEVICE_ARGS="--target-device tv"
  33. ;;
  34. 4)
  35. TARGET_DEVICE_ARGS="--target-device watch"
  36. ;;
  37. *)
  38. TARGET_DEVICE_ARGS="--target-device mac"
  39. ;;
  40. esac
  41. install_resource()
  42. {
  43. if [[ "$1" = /* ]] ; then
  44. RESOURCE_PATH="$1"
  45. else
  46. RESOURCE_PATH="${PODS_ROOT}/$1"
  47. fi
  48. if [[ ! -e "$RESOURCE_PATH" ]] ; then
  49. cat << EOM
  50. error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
  51. EOM
  52. exit 1
  53. fi
  54. case $RESOURCE_PATH in
  55. *.storyboard)
  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\" .storyboard`.storyboardc $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\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
  58. ;;
  59. *.xib)
  60. 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
  61. 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}
  62. ;;
  63. *.framework)
  64. echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
  65. mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  66. echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
  67. rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  68. ;;
  69. *.xcdatamodel)
  70. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
  71. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
  72. ;;
  73. *.xcdatamodeld)
  74. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
  75. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
  76. ;;
  77. *.xcmappingmodel)
  78. echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
  79. xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
  80. ;;
  81. *.xcassets)
  82. ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
  83. XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
  84. ;;
  85. *)
  86. echo "$RESOURCE_PATH" || true
  87. echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
  88. ;;
  89. esac
  90. }
  91. if [[ "$CONFIGURATION" == "Debug" ]]; then
  92. install_resource "${PODS_ROOT}/AlipaySDK-iOS/AlipaySDK.bundle"
  93. install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
  94. install_resource "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle"
  95. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RongCloud.bundle"
  96. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/en.lproj"
  97. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/zh-Hans.lproj"
  98. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/ar.lproj"
  99. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/Emoji.plist"
  100. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCColor.plist"
  101. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCConfig.plist"
  102. install_resource "${PODS_ROOT}/RongCloudRTC/RongCloudRTC/RongRTCLib.bundle"
  103. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon.bundle"
  104. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonLocalizable.bundle"
  105. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonTheme.bundle"
  106. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon_Minimalist.bundle"
  107. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat.bundle"
  108. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatFace.bundle"
  109. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatLocalizable.bundle"
  110. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatTheme.bundle"
  111. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat_Minimalist.bundle"
  112. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation.bundle"
  113. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme.bundle"
  114. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme_Minimalist.bundle"
  115. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation_Minimalist.bundle"
  116. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICore.bundle"
  117. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme.bundle"
  118. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme_Minimalist.bundle"
  119. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUIKitLocalizable.bundle"
  120. install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroup.bundle"
  121. install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroupTheme.bundle"
  122. install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearch.bundle"
  123. install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearchTheme.bundle"
  124. install_resource "${PODS_CONFIGURATION_BUILD_DIR}/Whiteboard/Whiteboard.bundle"
  125. fi
  126. if [[ "$CONFIGURATION" == "Release" ]]; then
  127. install_resource "${PODS_ROOT}/AlipaySDK-iOS/AlipaySDK.bundle"
  128. install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
  129. install_resource "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle"
  130. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RongCloud.bundle"
  131. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/en.lproj"
  132. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/zh-Hans.lproj"
  133. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/ar.lproj"
  134. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/Emoji.plist"
  135. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCColor.plist"
  136. install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCConfig.plist"
  137. install_resource "${PODS_ROOT}/RongCloudRTC/RongCloudRTC/RongRTCLib.bundle"
  138. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon.bundle"
  139. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonLocalizable.bundle"
  140. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonTheme.bundle"
  141. install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon_Minimalist.bundle"
  142. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat.bundle"
  143. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatFace.bundle"
  144. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatLocalizable.bundle"
  145. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatTheme.bundle"
  146. install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat_Minimalist.bundle"
  147. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation.bundle"
  148. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme.bundle"
  149. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme_Minimalist.bundle"
  150. install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation_Minimalist.bundle"
  151. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICore.bundle"
  152. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme.bundle"
  153. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme_Minimalist.bundle"
  154. install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUIKitLocalizable.bundle"
  155. install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroup.bundle"
  156. install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroupTheme.bundle"
  157. install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearch.bundle"
  158. install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearchTheme.bundle"
  159. install_resource "${PODS_CONFIGURATION_BUILD_DIR}/Whiteboard/Whiteboard.bundle"
  160. fi
  161. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  162. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  163. if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  164. mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  165. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  166. fi
  167. rm -f "$RESOURCES_TO_COPY"
  168. if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
  169. then
  170. # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  171. OTHER_XCASSETS=$(find -L "$PWD" -iname "*.xcassets" -type d)
  172. while read line; do
  173. if [[ $line != "${PODS_ROOT}*" ]]; then
  174. XCASSET_FILES+=("$line")
  175. fi
  176. done <<<"$OTHER_XCASSETS"
  177. if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
  178. 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}"
  179. else
  180. 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"
  181. fi
  182. fi