Created
December 17, 2015 09:07
-
-
Save edwardean/907b09129e0ca40322f1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Current Build Configuration : ${CONFIGURATION}" | |
if [ "Release" != "${CONFIGURATION}" ]; then | |
PATH=${PATH}:/usr/local/bin | |
IFS=$'\n' | |
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
versionNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${PROJECT_DIR}/${INFOPLIST_FILE}") | |
function generateIcon () { | |
BASE_IMAGE_NAME=$1 | |
TARGET_IMAGE_NAME=$2 | |
BASE_IMAGE_PATH=$(find ${SRCROOT} -name ${BASE_IMAGE_NAME}) | |
TARGET_PATH="${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${TARGET_IMAGE_NAME}" | |
WIDTH=$(identify -format %w ${BASE_IMAGE_PATH}) | |
FONT_SIZE=$(echo "$WIDTH * .2" | bc -l) | |
echo "use font size $FONT_SIZE, version:$versionNumber, build:$buildNumber" | |
echo ${TARGET_PATH} | |
convert ${BASE_IMAGE_PATH} -fill white -font Times-Bold \ | |
-pointsize ${FONT_SIZE} -gravity south -annotate 0 "$versionNumber $buildNumber" ${TARGET_PATH} | |
} | |
if hash convert 2>/dev/null; then | |
generateIcon "Icon-57.png" "AppIcon57x57.png" | |
generateIcon "[email protected]" "[email protected]" | |
generateIcon "[email protected]" "[email protected]" | |
generateIcon "[email protected]" "[email protected]" | |
else | |
echo "ImageMagick not installed." | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment