Fjalapeno has uploaded a new change for review.
https://gerrit.wikimedia.org/r/202909
Change subject: Fix for T94534 not working on iPads
......................................................................
Fix for T94534 not working on iPads
Shell script was setting names based on the assets file but file names in the
catalog are apparently is not uniform.
The fix is using the files in the app bundle for the source.
This actually simplifies the script quite a bit, so win win!
Additionally had to do some dangling to loop over paths that have spaces
Change-Id: Ic3f909e250b7eddfd115131c4115a7aef09b8c1b
---
M scripts/process-icons.sh
1 file changed, 18 insertions(+), 38 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia
refs/changes/09/202909/1
diff --git a/scripts/process-icons.sh b/scripts/process-icons.sh
index 8e1664e..6017ede 100755
--- a/scripts/process-icons.sh
+++ b/scripts/process-icons.sh
@@ -8,41 +8,38 @@
build=`/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${INFOPLIST_FILE}"`
#Where to save the files
-target_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
+icon_directory_path="${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
+echo "icon directory: "$icon_directory_path
function processIconSet() {
export PATH=$PATH:/usr/local/bin
- #Don't do this for App Store or Instore Release
+ #Don't do this for App Store Release
if [ "$CONFIGURATION" == "Release" ]; then
exit 0
fi
- #Make path to existing icons
- source_icon_set=$1
- source_icon_set_folder_name=$source_icon_set".appiconset"
- echo $source_icon_set_folder_name
+ source_icon_set_prefix=$1
+ echo "Source icon Prefix: "$source_icon_set_prefix
- #Find existing icons
- source_icon_set_directory=`find . -name $source_icon_set_folder_name
-type d`
- echo "Source icon directory: "$source_icon_set_directory
+ source_icons=`find "$icon_directory_path" -name
"$source_icon_set_prefix*.png" -type f`
+ echo "Source icons: "$source_icons
- #Make target base file name - same as asset collection name
- target_base_file_name=$source_icon_set
- echo "Target base file name: "$target_base_file_name
+ SAVEIFS=$IFS
+ IFS=$(echo -en "\n\b")
+ echo "Set IFS for unescaped for loop paths"
+ #Tip found here:
http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html
#Loop through icons
- for source_icon_path in $(find $source_icon_set_directory -name "*.png"
-type f); do
+ for source_icon_path in ${source_icons}; do
+
+ echo "Source icon path: $source_icon_path"
#Image meta
minimum_width=""
- retina_suffix=""
width=""
height=""
- icon_size_suffix=""
- width_suffix=""
- height_suffix=""
overlay_height=""
overlay_color="#0008"
@@ -50,50 +47,30 @@
#Populate the image meta based on retina and size
if [[ $source_icon_path == *"@3x"* ]]; then
minimum_width=114
- retina_suffix="@3x"
width=`identify -format %w "$source_icon_path"`
height=`identify -format %h "$source_icon_path"`
- width_suffix=$width
- height_suffix=$height
- let "width_suffix/=3"
- let "height_suffix/=3"
overlay_height=60
elif [[ $source_icon_path == *"@2x"* ]]; then
minimum_width=114
- retina_suffix="@2x"
width=`identify -format %w "$source_icon_path"`
height=`identify -format %h "$source_icon_path"`
- width_suffix=$width
- height_suffix=$height
- let "width_suffix/=2"
- let "height_suffix/=2"
overlay_height=40
else
minimum_width=57
- retina_suffix=""
width=`identify -format %w "$source_icon_path"`
height=`identify -format %h "$source_icon_path"`
- width_suffix=$width
- height_suffix=$height
overlay_height=20
fi
-
- icon_size_suffix=$width_suffix"x"$height_suffix
#Only process icons that show on home screens (larger ones)
if [ $width -ge $minimum_width ]; then
echo "Overlaying source Image "$source_icon_path
- #Assemble the final file path
-
target_icon_file_name=$target_base_file_name$icon_size_suffix$retina_suffix".png"
- target_icon_path=$target_path$target_icon_file_name
- echo $source_icon_path" = "$target_icon_path
-
#Overlay Image
convert -background $overlay_color -fill white -gravity
center -size ${width}x${overlay_height}\
caption:"${CONFIGURATION}\n(${build})"\
- "${source_icon_path}" +swap -gravity south -composite
"${target_icon_path}"
+ "${source_icon_path}" +swap -gravity south -composite
"${source_icon_path}"
else
@@ -103,5 +80,8 @@
done
+ IFS=$SAVEIFS
+ echo "Reset IFS"
+
}
processIconSet "AppIcon"
--
To view, visit https://gerrit.wikimedia.org/r/202909
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic3f909e250b7eddfd115131c4115a7aef09b8c1b
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Fjalapeno <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits