teachers-assistant

[RADIOACTIVE] oh boy did i make bad apps back in the day
git clone git://git.figbert.com/teachers-assistant.git
Log | Files | Refs

Pods-TeachersAssistant-resources.sh (6690B)


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