Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[CopyResourcesScript] FIX xcassets not compatible with Xcode < 5.0.0. #1511

Closed
wants to merge 3 commits into
from

Conversation

Projects
None yet
4 participants
Contributor

michalkonturek commented Oct 26, 2013

Added additional if-statement to check if Xcode 5 is installed.

xcassets were introduced in that version and if you try compile Xcode 5 project on Xcode 4.6 (when testing on Travis as Travis has not yet been updated with Xcode 5), the entire test fails due to build failure:

Run custom shell script 'Copy Pods Resources'
...
xargs: actool: No such file or directory

Coverage Status

Coverage remained the same when pulling 87b0006 on michalkonturek:master into 92aa8a2 on CocoaPods:master.

Owner

alloy commented Oct 28, 2013

Thanks for taking the time, however I would prefer if we don’t test for versions, but for features. E.g.

$ xcrun --find actool
/Applications/Xcode.app/Contents/Developer/usr/bin/actool
$ xcrun --find non-existing
xcrun: error: unable to find utility "non-existing", not a developer tool or in PATH

Can you verify that that works with Xcode 4 and update the patch?

Owner

alloy commented Oct 28, 2013

BTW, I assume xcrun will also set a sensible exit status code, so better to use that than parsing the output.

Owner

alloy commented Oct 28, 2013

@ulrikdamm If you have a different idea about my suggestions, please chime in.

Owner

alloy commented Oct 28, 2013

@michalkonturek Additionally, can you add an entry to the CHANGELOG?

@fabiopelosin fabiopelosin and 1 other commented on an outdated diff Oct 28, 2013

lib/cocoapods/generator/copy_resources_script.rb
@@ -137,10 +137,13 @@ def script
XCASSETS_COMPILE = <<EOS
-if [ `find . -name '*.xcassets' | wc -l` -ne 0 ]
-then
- DEVICE=`if [ "${TARGETED_DEVICE_FAMILY}" -eq 1 ]; then echo "iphone"; else echo "ipad"; fi`
- find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" --target-device "${DEVICE}" --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}.${WRAPPER_EXTENSION}"
+XCODE_MAJOR_VERSION=`xcodebuild -version | awk 'NR == 1 {print substr($2,1,1)}'`
@fabiopelosin

fabiopelosin Oct 28, 2013

Owner

The XCODE_MAJOR_VERSION should be already set by Xcode while running the script.

@michalkonturek

michalkonturek Oct 31, 2013

Contributor

You are correct. Thanks.

Contributor

michalkonturek commented Oct 31, 2013

@alloy Your recommendation xcrun --find actool works great. I will update the pull request and add an entry to the CHANGELOG.

Contributor

michalkonturek commented Oct 31, 2013

Done. Thanks for the pointers guys.

Owner

alloy commented Nov 2, 2013

I rebased your commits and merged it as 1429e60.

Can you double-check that the updated form works properly for you?

/cc @nmccann

@alloy alloy closed this Nov 2, 2013

Contributor

michalkonturek commented Dec 4, 2013

I am sorry for the late reply.
Yes, it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment