123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193 |
- #!/bin/sh
- set -e
- set -u
- set -o pipefail
- function on_error {
- echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
- }
- trap 'on_error $LINENO' ERR
- if [ -z ${UNLOCALIZED_RESOURCES_FOLDER_PATH+x} ]; then
- # If UNLOCALIZED_RESOURCES_FOLDER_PATH is not set, then there's nowhere for us to copy
- # resources to, so exit 0 (signalling the script phase was successful).
- exit 0
- fi
- mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
- > "$RESOURCES_TO_COPY"
- XCASSET_FILES=()
- # This protects against multiple targets copying the same framework dependency at the same time. The solution
- # was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
- RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
- case "${TARGETED_DEVICE_FAMILY:-}" in
- 1,2)
- TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
- ;;
- 1)
- TARGET_DEVICE_ARGS="--target-device iphone"
- ;;
- 2)
- TARGET_DEVICE_ARGS="--target-device ipad"
- ;;
- 3)
- TARGET_DEVICE_ARGS="--target-device tv"
- ;;
- 4)
- TARGET_DEVICE_ARGS="--target-device watch"
- ;;
- *)
- TARGET_DEVICE_ARGS="--target-device mac"
- ;;
- esac
- install_resource()
- {
- if [[ "$1" = /* ]] ; then
- RESOURCE_PATH="$1"
- else
- RESOURCE_PATH="${PODS_ROOT}/$1"
- fi
- if [[ ! -e "$RESOURCE_PATH" ]] ; then
- cat << EOM
- error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
- EOM
- exit 1
- fi
- case $RESOURCE_PATH in
- *.storyboard)
- 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
- 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}
- ;;
- *.xib)
- 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
- 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}
- ;;
- *.framework)
- echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
- mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
- echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
- rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
- ;;
- *.xcdatamodel)
- echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
- xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
- ;;
- *.xcdatamodeld)
- echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
- xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
- ;;
- *.xcmappingmodel)
- echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
- xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
- ;;
- *.xcassets)
- ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH"
- XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
- ;;
- *)
- echo "$RESOURCE_PATH" || true
- echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
- ;;
- esac
- }
- if [[ "$CONFIGURATION" == "Debug" ]]; then
- install_resource "${PODS_ROOT}/AlipaySDK-iOS/AlipaySDK.bundle"
- install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
- install_resource "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RongCloud.bundle"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/en.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/zh-Hans.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/ar.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/Emoji.plist"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCColor.plist"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCConfig.plist"
- install_resource "${PODS_ROOT}/RongCloudRTC/RongCloudRTC/RongRTCLib.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonLocalizable.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonTheme.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatFace.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatLocalizable.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatTheme.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICore.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUIKitLocalizable.bundle"
- install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroup.bundle"
- install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroupTheme.bundle"
- install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearch.bundle"
- install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearchTheme.bundle"
- install_resource "${PODS_CONFIGURATION_BUILD_DIR}/Whiteboard/Whiteboard.bundle"
- fi
- if [[ "$CONFIGURATION" == "Release" ]]; then
- install_resource "${PODS_ROOT}/AlipaySDK-iOS/AlipaySDK.bundle"
- install_resource "${PODS_ROOT}/MJRefresh/MJRefresh/MJRefresh.bundle"
- install_resource "${PODS_ROOT}/RSKImageCropper/RSKImageCropper/RSKImageCropperStrings.bundle"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RongCloud.bundle"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/en.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/zh-Hans.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/ar.lproj"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/Emoji.plist"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCColor.plist"
- install_resource "${PODS_ROOT}/RongCloudIM/RongCloudIM/RCConfig.plist"
- install_resource "${PODS_ROOT}/RongCloudRTC/RongCloudRTC/RongRTCLib.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonLocalizable.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommonTheme.bundle"
- install_resource "${PODS_ROOT}/TIMCommon/TIMCommon/Resources/TIMCommon_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatFace.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatLocalizable.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChatTheme.bundle"
- install_resource "${PODS_ROOT}/TUIChat/TUIChat/Resources/TUIChat_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversationTheme_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUIConversation/TUIConversation/Resources/TUIConversation_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICore.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUICoreTheme_Minimalist.bundle"
- install_resource "${PODS_ROOT}/TUICore/TUICore/Resources/TUIKitLocalizable.bundle"
- install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroup.bundle"
- install_resource "${PODS_ROOT}/TUIGroup/TUIGroup/Resources/TUIGroupTheme.bundle"
- install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearch.bundle"
- install_resource "${PODS_ROOT}/TUISearch/TUISearch/Resources/TUISearchTheme.bundle"
- install_resource "${PODS_CONFIGURATION_BUILD_DIR}/Whiteboard/Whiteboard.bundle"
- fi
- mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
- mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
- fi
- rm -f "$RESOURCES_TO_COPY"
- if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "${XCASSET_FILES:-}" ]
- then
- # Find all other xcassets (this unfortunately includes those of path pods and other targets).
- OTHER_XCASSETS=$(find -L "$PWD" -iname "*.xcassets" -type d)
- while read line; do
- if [[ $line != "${PODS_ROOT}*" ]]; then
- XCASSET_FILES+=("$line")
- fi
- done <<<"$OTHER_XCASSETS"
- if [ -z ${ASSETCATALOG_COMPILER_APPICON_NAME+x} ]; then
- 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}"
- else
- 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"
- fi
- fi
|