Project: titanium
Issue TIMOB-19554: iOS: pngcrush fails build when crushing an invalid png image
If you have a .png image in your Resources dir that is actually a .gif but with the wrong extension, pngcrush will blow up and the build will fail. Depending on your luck, you will either get no error or a file rename error. pngcrush returns 0 if crushing fails, which is probably a bug with pngcrush (or at least the one shipped with Xcode 7). The rename error happens because pngcrush take the input file and writes the crushed png to another file and the iOS build needs to rename it back to the correct filename. If the temporary crushed png image was never generated, then there's nothing to rename and then it blows up. It's worth noting that in Titanium SDK 4.x and older, the iOS build called {{/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/iphoneos-optimize}}. This is a perl script that converts plists into binary format and crushes pngs. The problem with this script is if pngcrush fails, it aborts the entire script and returns 0. This is bad. A) this potentially does not optimize several unprocessed PNG images and B) doesn't return an error code. So, this image optimization has been silently failing for years.
Story points: 5