[TIMOB-19554] iOS: pngcrush fails build when crushing an invalid png image
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-09-21T06:11:44.000+0000 |
Affected Version/s | Release 5.0.0 |
Fix Version/s | Release 5.1.0, Release 5.0.1 |
Components | iOS, Tooling |
Labels | n/a |
Reporter | Chris Barber |
Assignee | Chris Barber |
Created | 2015-09-21T04:59:40.000+0000 |
Updated | 2015-09-22T17:36:53.000+0000 |
Description
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.
Master PR: https://github.com/appcelerator/titanium_mobile/pull/7213 5_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/7214
APPROVED. PRs merged.
Verified fixed, using: MacOS 10.11 (15A279b) Studio 4.3.0.201509151348 Ti SDK 5.0.1.v20150922062312 Appc NPM 4.2.0 Appc CLI 5.0.1-5 Ti CLI 5.0.3 Alloy 1.7.8 Arrow 1.2.62 Xcode 7.0 (7A218) Node v0.10.37 Java 1.7.0_45 preproduction After several builds of varying target and cleanliness, this error was not encountered with Alloy or Classic projects.