xcassets compiling doesn't consider universal apps #1520

Closed
TomCarey opened this Issue Oct 28, 2013 · 19 comments

Comments

Projects
None yet
6 participants

When using

TARGETED_DEVICE_FAMILY 1,2

none of my app resources get included.

Error result:

/[REDACTED]-resources.sh: line 79: [: 1,2: integer expression expected
Contributor

yas375 commented Oct 28, 2013

Have found the same error during investigation of facebook/xctool#227

2013-10-28_1605

Looks like the problem that the a file generated by lib/cocoapods/generator/copy_resources_script.rb doesn't expect universal apps when TARGETED_DEVICE_FAMILY is a string 1,2.

Demo app I used is here.

Owner

alloy commented Oct 28, 2013

@yas375 Hah, thanks for taking the time to post this here, I had not yet gone through all the new CP tickets :) 👍

Owner

alloy commented Oct 28, 2013

Is anyone going to create a patch for this?

/cc @ulrikdamm

Contributor

ulrikdamm commented Oct 28, 2013

I'll take a look at it later today.

Contributor

yas375 commented Oct 28, 2013

@alloy sure! Glad to help :)

Just curious what actool is. It's used in the command to compile assets in lib/cocoapods/generator/copy_resources_script.rb:

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}"

I don't see this command available to me in console.

➜  ~  actool
zsh: command not found: actool
➜  ~  which actool
actool not found

Is it comes with Xcode command line tools? Xcode says that I have installed command line tools, but maybe I have something wrong on my dev machine?

2013-10-28_1624

I'm on fresh Mavericks install.

Owner

alloy commented Oct 28, 2013

@ulrikdamm Awesome, thanks!

Owner

alloy commented Oct 28, 2013

@yas375 Yes, it’s in the Command-Line Tools, but it’s not linked into /usr/bin. You need to use xcrun, e.g.:

$ xcrun --find actool
/Applications/Xcode.app/Contents/Developer/usr/bin/actool
Contributor

yas375 commented Oct 28, 2013

@alloy gotcha :) Didn't know about xcrun. Thanks.

Now I noticed xcrun is used with momc in the same file.

And seems like there is one more bug can be fixed in that line: actool needs to be prefixed with xcrun ;)

➜  ExampleApp git:(facebook-xctool-227) find . -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text
xargs: actool: No such file or directory
➜  ExampleApp git:(facebook-xctool-227) find . -name "*.xcassets" -print0 | xargs -0 xcrun actool --output-format human-readable-text
➜  ExampleApp git:(facebook-xctool-227)

/cc @ulrikdamm

Contributor

yas375 commented Oct 28, 2013

@ulrikdamm @alloy have found man actool:

 --target-device device-name
              Specifies the target device to compile for, and may be passed multiple times. This option influences  warnings,  validation,  and  which  images  are
              included in the built product.

So if the solution is to add it twice with both iphone and ipad values for universal apps, then probably I also will be able to fix it :)

Let me know if you have other work to do, and I can take care of this today or tomorrow ;)

Owner

alloy commented Oct 28, 2013

As @kylef just pointed out to me, the current script also fails when targeting OS X, in which case the device family should be ‘mac’.

Owner

fabiopelosin commented Oct 28, 2013

👍

Owner

alloy commented Oct 30, 2013

@yas375 In case you have some time, I would love a patch for this. I think @ulrikdamm is too busy atm, which can happen :)

Contributor

yas375 commented Oct 30, 2013

@alloy ok. Will do it today or tomorrow :)

yas375 was assigned Oct 30, 2013

Contributor

yas375 commented Nov 1, 2013

Sorry guys. Too busy at work these days. Will fix this during the weekend ;)

Contributor

ryanwmarsh commented Nov 6, 2013

Please ignore my first pull request I hadn't updated the specs. This will not pass in Travis without using my other pull request CocoaPods/cocoapods-integration-specs#2

Contributor

ryanwmarsh commented Nov 13, 2013

Ok I added a new pull request #1594 because I screwed up the git squash. This needs CocoaPods/cocoapods-integration-specs#2 for specs to pass.

Contributor

ryanwmarsh commented Nov 13, 2013

@yas375 Will this do?

Contributor

ryanwmarsh commented Nov 14, 2013

Can we close this now?

Owner

fabiopelosin commented Nov 14, 2013

I think so!

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