Last active
August 29, 2015 14:25
-
-
Save Galeas/f212b1e8635f88e834c0 to your computer and use it in GitHub Desktop.
Version number & build on iOS app icon
This file contains 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
# необходимы установленные пакеты imagemagick и ghostscript | |
# если у нас релизная сборка, то нам нужна обычная иконка | |
if [ $CONFIGURATION = "Release" ]; then | |
return | |
fi | |
# номер версии | |
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"` | |
# номер билда | |
build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"` | |
# если нужно, можно взять имя ветки из git | |
branch=`git rev-parse --abbrev-ref HEAD` | |
# функция генерации иконки | |
function processIcon() { | |
export PATH=$PATH:/usr/local/bin | |
base_file=$1 | |
target_icon_name=$2 | |
base_path=`find ${SRCROOT} -name $base_file` | |
if [[ ! -f ${base_path} || -z ${base_path} ]]; then | |
return; | |
fi | |
target_file=`echo $target_icon_name | sed "s/_base//"` | |
target_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${target_file}" | |
width=`identify -format %w ${base_path}` | |
echo $target_path | |
echo $target_file | |
convert -background '#0008' -fill white -gravity center -size ${width}x40 -pointsize 26\ | |
caption:"${version} (${build})"\ | |
${base_path} +swap -gravity south -composite ${target_path} | |
} | |
# запускаем генерацию | |
# подставить свои имена файлов | |
processIcon "ewrw_120-1.png" "AppIcon60x60@2x.png" | |
processIcon "ewrw_180.png" "AppIcon60x60@3x.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment