
Here I propose the final process for our team to add a device to the ad hoc provisioning profile and getting it into our CI system (Hudson, still rocking). This process is not what I would like it to be, just the best I can hope for.
As you only get 100 changes to the distribution profile per year, it’s not a good idea to get the UUID wrong. So rather than manually typing it in, we need a way to copy it to the clipboard and pasting it to the developer portal. ITunes doesn’t allow you to use the clipboard, and not everyone here has a mac (and thus no XCode). So instead, we’ll use the Ad Hoc Helper which emails the ID to whomever you wish.
If you have an IPhone developer account over at apple, there’s an adequate howto on this. Bottom line is, add as many devices in one go as you can.
We use git for this project, and we keep a copy of the current .mobileprovision in a directory that, when changed, naturally triggers a new build.
Note: The slave machine is forced to run a single build at a time (one Hudson Executor) to make this work reliably
Heres the Hudson ‘Execute Shell’ script I used to achieve the above. It’s designed to work with our rhomobile app. I’ve tried to highlight what you need to change etc.
# (1) Clear the library
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/*
# (2) Move the .mobileprovision file into place
# keep the provisioning profile in <workspace_root>/provisioning_profiles
# change the provisioning profile name to match yours.
cp provisioning_profiles/Ad_Hoc_Scheduling.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
# (3) Sed the file for it's UUID
# keep the provisioning profile in <workspace_root>/provisioning_profiles
# change the provisioning profile name to match yours.
PROFILE_UUID=`grep "<key>UUID</key>" provisioning_profiles/Ad_Hoc_Scheduling.mobileprovision -A 1 --binary-files=text | sed -E -e "/<key>/ d" -e "s/(^.*<string>)//" -e "s/(<.*)//"`
# (4) Update the project to use it.
# The zerg_provision file is shown later.
# First argument is the location of the XCode project
# Second argument is my the target configuration for the build
# Third argument is the project target (you'll need to call this command repeatedly for more targets)
# Last argument, the UUID of the profile being injected
ruby tools/zerg_provision.rb platform/iphone AdHoc rhorunner $PROFILE_UUID
# (5) Allow chain access
# Replace ***** with your chain password
security unlock-keychain -p ***** ~/Library/Keychains/login.keychain
# (6) Build.
cd platform/iphone/ # location of the project
xcodebuild -configuration AdHoc -sdk iphoneos2.2.1 # AdHoc is my configuration.
require 'rubygems'
require 'zerg_xcode' # http://github.com/costan/zerg_xcode/tree/master
require 'pp'
project = ZergXcode.load(ARGV.shift)
configuration = ARGV.shift
target = ARGV.shift
key = ARGV.shift
build_configurations = project["buildConfigurationList"]["buildConfigurations"]
configuration_object = build_configurations.select {|item| item['name'] == configuration }[0]
configuration_object["buildSettings"]["PROVISIONING_PROFILE"] = key
configuration_object["buildSettings"]["PROVISIONING_PROFILE[sdk=iphoneos*]"] = key
target = project["targets"].select {|item| item['name'] == target }[0]
build_configurations = target["buildConfigurationList"]["buildConfigurations"]
configuration_object = build_configurations.select {|item| item['name'] == configuration }[0]
configuration_object["buildSettings"]["PROVISIONING_PROFILE[sdk=iphoneos*]"] = key
project.save!
© 2010 - VisFleet Ltd
No prawns were harmed in
the making of this website
Comments