git.iko.soy/typeable/nixpkgs
on master help sign in
xcodeenv: Reimplement simulator script to work with Xcode 6
commitf58b563cb65dc0611815f3a5570dd704e61810c3 authorSander van der Burg <svanderburg@mgail.com> dateWed 15 Oct 2014, 17:10 (12 years ago) parent2ffe274
2 files changed+36−11
pkgs/development/mobile/xcodeenv/simulate-app.nix+35−10 pkgs/development/mobile/xcodeenv/xcodewrapper.nix+1−1
pkgs/development/mobile/xcodeenv/simulate-app.nix+35−10
@@ -1,22 +1,47 @@
11{stdenv, xcodewrapper}:
2−{ name, appName ? null, app
3−, device ? "iPhone", baseDir ? ""
4−, sdkVersion ? "7.0"
5−}:
2+{name, bundleId, app}:
63
7−let
8− _appName = if appName == null then name else appName;
9−in
104stdenv.mkDerivation {
115 name = stdenv.lib.replaceChars [" "] [""] name;
126 buildCommand = ''
137 mkdir -p $out/bin
148 cat > $out/bin/run-test-simulator << "EOF"
159 #! ${stdenv.shell} -e
16−
17− cd "${app}/${baseDir}/${_appName}.app"
18− "$(readlink "${xcodewrapper}/bin/iPhone Simulator")" -SimulateApplication './${_appName}' -SimulateDevice '${device}' -currentSDKRoot "$(readlink "${xcodewrapper}/SDKs")/iPhoneSimulator${sdkVersion}.sdk"
10+
11+ if [ "$1" = "" ]
12+ then
13+ # Show the user the possibile UDIDs and let him pick one, if none is provided as a command-line parameter
14+ xcrun simctl list
15+
16+ echo "Please provide a UDID of a simulator:"
17+ read udid
18+ else
19+ # If a parameter has been provided, consider that a device UDID an use that
20+ udid="$1"
21+ fi
22+
23+ # Open the simulator instance
24+ open -a "$(readlink "${xcodewrapper}/bin/iOS Simulator")" --args -CurrentDeviceUDID $udid
25+
26+ # Copy the app and restore the write permissions
27+ appTmpDir=$(mktemp -d -t appTmpDir)
28+ cp -r "$(echo ${app}/*.app)" $appTmpDir
29+ chmod -R 755 "$(echo $appTmpDir/*.app)"
30+
31+ # Wait for the simulator to start
32+ echo "Press enter when the simulator is started..."
33+ read
34+
35+ # Install the app
36+ xcrun simctl install $udid "$(echo $appTmpDir/*.app)"
37+
38+ # Remove the app tempdir
39+ rm -Rf $appTmpDir
40+
41+ # Launch the app in the simulator
42+ xcrun simctl launch $udid "${bundleId}"
1943 EOF
44+
2045 chmod +x $out/bin/run-test-simulator
2146 '';
2247}
pkgs/development/mobile/xcodeenv/xcodewrapper.nix+1−1
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
1010 ln -s /usr/bin/codesign
1111 ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcodebuild"
1212 ln -s "${xcodeBaseDir}/Contents/Developer/usr/bin/xcrun"
13− ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator"
13+ ln -s "${xcodeBaseDir}/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS Simulator"
1414
1515 cd ..
1616 ln -s "${xcodeBaseDir}/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs"