Açıklama Yok

Pods-FirstLinkTests-resources.sh 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 "IQKeyboardManager/IQKeyBoardManager/Resources/IQKeyboardManager.bundle"
  78. install_resource "$PODS_CONFIGURATION_BUILD_DIR/MXSegmentedPager/MXSegmentedPager.bundle"
  79. fi
  80. if [[ "$CONFIGURATION" == "Release" ]]; then
  81. install_resource "IQKeyboardManager/IQKeyBoardManager/Resources/IQKeyboardManager.bundle"
  82. install_resource "$PODS_CONFIGURATION_BUILD_DIR/MXSegmentedPager/MXSegmentedPager.bundle"
  83. fi
  84. mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  85. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  86. if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then
  87. mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  88. rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
  89. fi
  90. rm -f "$RESOURCES_TO_COPY"
  91. if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ]
  92. then
  93. # Find all other xcassets (this unfortunately includes those of path pods and other targets).
  94. OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d)
  95. while read line; do
  96. if [[ $line != "`realpath $PODS_ROOT`*" ]]; then
  97. XCASSET_FILES+=("$line")
  98. fi
  99. done <<<"$OTHER_XCASSETS"
  100. 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}"
  101. fi