Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 

143 řádky
7.8 KiB

  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. *)
  18. TARGET_DEVICE_ARGS="--target-device mac"
  19. ;;
  20. esac
  21. realpath() {
  22. DIRECTORY="$(cd "${1%/*}" && pwd)"
  23. FILENAME="${1##*/}"
  24. echo "$DIRECTORY/$FILENAME"
  25. }
  26. install_resource()
  27. {
  28. if [[ "$1" = /* ]] ; then
  29. RESOURCE_PATH="$1"
  30. else
  31. RESOURCE_PATH="${PODS_ROOT}/$1"
  32. fi
  33. if [[ ! -e "$RESOURCE_PATH" ]] ; then
  34. cat << EOM
  35. error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script.
  36. EOM
  37. exit 1
  38. fi
  39. case $RESOURCE_PATH in
  40. *.storyboard)
  41. 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}"
  42. 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. ;;
  44. *.xib)
  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\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
  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\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
  47. ;;
  48. *.framework)
  49. echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  50. mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  51. echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  52. rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
  53. ;;
  54. *.xcdatamodel)
  55. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
  56. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
  57. ;;
  58. *.xcdatamodeld)
  59. echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
  60. xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
  61. ;;
  62. *.xcmappingmodel)
  63. echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
  64. xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
  65. ;;
  66. *.xcassets)
  67. ABSOLUTE_XCASSET_FILE=$(realpath "$RESOURCE_PATH")
  68. XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
  69. ;;
  70. *)
  71. echo "$RESOURCE_PATH"
  72. echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
  73. ;;
  74. esac
  75. }
  76. if [[ "$CONFIGURATION" == "Debug" ]]; then
  77. install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
  78. install_resource "TSMessages/Pod/Assets/NotificationBackgroundError.png"
  79. install_resource "TSMessages/Pod/Assets/NotificationBackgroundError@2x.png"
  80. install_resource "TSMessages/Pod/Assets/NotificationBackgroundErrorIcon.png"
  81. install_resource "TSMessages/Pod/Assets/NotificationBackgroundErrorIcon@2x.png"
  82. install_resource "TSMessages/Pod/Assets/NotificationBackgroundMessage.png"
  83. install_resource "TSMessages/Pod/Assets/NotificationBackgroundMessage@2x.png"
  84. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccess.png"
  85. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccess@2x.png"
  86. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccessIcon.png"
  87. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccessIcon@2x.png"
  88. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarning.png"
  89. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarning@2x.png"
  90. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarningIcon.png"
  91. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarningIcon@2x.png"
  92. install_resource "TSMessages/Pod/Assets/NotificationButtonBackground.png"
  93. install_resource "TSMessages/Pod/Assets/NotificationButtonBackground@2x.png"
  94. install_resource "TSMessages/Pod/Assets/TSMessagesDefaultDesign.json"
  95. fi
  96. if [[ "$CONFIGURATION" == "Release" ]]; then
  97. install_resource "MJRefresh/MJRefresh/MJRefresh.bundle"
  98. install_resource "TSMessages/Pod/Assets/NotificationBackgroundError.png"
  99. install_resource "TSMessages/Pod/Assets/NotificationBackgroundError@2x.png"
  100. install_resource "TSMessages/Pod/Assets/NotificationBackgroundErrorIcon.png"
  101. install_resource "TSMessages/Pod/Assets/NotificationBackgroundErrorIcon@2x.png"
  102. install_resource "TSMessages/Pod/Assets/NotificationBackgroundMessage.png"
  103. install_resource "TSMessages/Pod/Assets/NotificationBackgroundMessage@2x.png"
  104. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccess.png"
  105. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccess@2x.png"
  106. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccessIcon.png"
  107. install_resource "TSMessages/Pod/Assets/NotificationBackgroundSuccessIcon@2x.png"
  108. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarning.png"
  109. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarning@2x.png"
  110. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarningIcon.png"
  111. install_resource "TSMessages/Pod/Assets/NotificationBackgroundWarningIcon@2x.png"
  112. install_resource "TSMessages/Pod/Assets/NotificationButtonBackground.png"
  113. install_resource "TSMessages/Pod/Assets/NotificationButtonBackground@2x.png"
  114. install_resource "TSMessages/Pod/Assets/TSMessagesDefaultDesign.json"
  115. fi
  116. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  117. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  118. if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  119. mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  120. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  121. fi
  122. rm -f "$RESOURCES_TO_COPY"
  123. if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
  124. then
  125. # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  126. OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  127. while read line; do
  128. if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
  129. XCASSET_FILES+=("$line")
  130. fi
  131. done <<<"$OTHER_XCASSETS"
  132. 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}"
  133. fi