Created
September 11, 2013 04:23
-
-
Save gdavis/6519324 to your computer and use it in GitHub Desktop.
Xcode Script to Create Icons for different build schemes
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
version=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${INFOPLIST_FILE}"` | |
build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"` | |
function processIcon() { | |
export PATH=$PATH:/usr/local/bin | |
base_file=$1 | |
base_path=`find "${SRCROOT}/CirrusMD" -name "${base_file}"` | |
if [[ ! -f "${base_path}" || -z "${base_path}" ]]; then | |
return; | |
fi | |
target_file=`echo "${base_file}" | sed "s/_base//"` | |
target_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/${target_file}" | |
if [ $CONFIGURATION = "Release" ]; then | |
cp "${base_path}" "${target_path}" | |
return | |
fi | |
width=`identify -format %w "${base_path}"` | |
if [ $CONFIGURATION = "Debug" ]; then | |
icon_color='#BCD631' | |
fi | |
if [ $CONFIGURATION = "Staging" ]; then | |
icon_color='#db420c' | |
fi | |
convert "${base_path}" -type Grayscale -fill "${icon_color}" -tint 100 "${target_path}" | |
convert -background '#0008' -fill white -gravity center -size "${width}"x30\ | |
caption:"${version} b${build}"\ | |
"${target_path}" +swap -gravity south -composite "${target_path}" | |
} | |
processIcon "Icon_base.png" | |
processIcon "Icon@2x_base.png" | |
processIcon "Icon-72_base.png" | |
processIcon "Icon-72@2x_base.png" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment