Export IPA & Travis CI

To make it short – how to waste several hours of your time :/ Decided to help with:

  • update Travis CI image to osx_xcode7,
  • archive several targets,
  • export Ad Hoc IPA,
  • generate release notes,
  • upload it to my beloved Hockey App and
  • replace HipChat notifications with Slack notifications.

Didn’t know that I’m going to spend several hours with this simple task. Especially
when I already made it for this project, but for Xcode 6, etc. Just wanted to update it little bit.

xcodebuild

So, the old way was without the -exportOptionsPlist argument. Check xcodebuild --help for
more info. Basically all your preferences like compileBitcode,
iCloudContainerEnvironment, iTunesConnectAccountUsername, manifest, method,
teamID, thinning, uploadBitcode, uploadSymbols, …
are stored in this file. And the final command looks like:

xcodebuild -exportArchive 
-exportOptionsPlist $PATH_TO_PLIST
-archivePath $PATH_TO_XCARCHIVE
-exportPath $OUTPUT_DIR

Nice, isn’t it? All these arguments about export format, signing identity, provisioning profiles, …
are gone. Love it.

Be aware of -exportPath. It’s a directory where to save exported IPA. Not a full path including
IPA file name. Don’t make this mistake. IIRC it did contain file name in previous version, but
I missed this when I was updating my script.

What’s also very nice is that it exports IPA in the same way as Xcode does. Kind of command line
version of Xcode export dialog.

Travis CI and Ruby & RVM

Tried it locally – did work. But this is what appeared in my Travis CI log:

[MT] IDEDistribution: Step failed: <IDEDistributionThinningStep: 0x7ff1a42d23f0>:
Error Domain=IDEDistributionErrorDomain Code=14 "No applicable devices found."
UserInfo=0x7ff1a72ddd80 {NSLocalizedDescription=No applicable devices found.}
error: exportArchive: No applicable devices found.

No applicable devices found. – what the hell is this? Never saw it. Google and
I found it’s Ruby & RVM related. Xcode 7 relies somehow on the system version of Ruby,
but there’s RVM, another Ruby, … in osx_xcode7 image, etc.

Why Ruby? Why RVM? Don’t like Ruby and every time I met Ruby I had problems.
Naively placed rvm use system in my build script and pushed again. Ooops.

RVM is not a function, selecting rubies with 'rvm use ...' will not work.

Jeeez, Ruby, let me live. Google again and found it does work, but in login shell
only. Okay, another push and it worked!

I found this SO question
later. Author of this question answered it as well and did provide nice Gist.
Don’t miss the shebang line with --login:

#!/bin/bash --login

xcbuild-safe.sh is what I use instead of xcodebuild now.

Rest went well, no need to write about it. Happy … Hope I’m not going to meet Ruby any time soon …