OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 # | |
3 # ios_setup.sh: Sets environment variables used by other iOS scripts. | |
4 | |
5 # File system location where we mount the ios devices. | |
6 IOS_MOUNT_POINT="/tmp/mnt_iosdevice" | |
7 | |
8 # Location on the ios device where all data are stored. This is | |
9 # relative to the mount point. | |
10 IOS_DOCS_DIR="Documents" | |
11 | |
12 # Temporary location to assemble the app into an .ipa package. | |
13 IOS_PCKG_DIR="/tmp/ios_pckg" | |
14 | |
15 # Bundle id of the app that runs the tests. | |
16 TEST_RUNNER_BUNDLE_ID="com.google.iOSShell" | |
17 | |
18 # Directory with the Skia source. | |
19 SKIA_SRC_DIR=$(cd "${SCRIPT_DIR}/../../.."; pwd) | |
20 | |
21 # BuildTYPE is 'Debug' by default. | |
22 BUILDTYPE="Debug" | |
23 | |
24 # Provisioning profile - this needs to be set up on the local machine. | |
25 PROVISIONING_PROFILE="9e88090d-abed-4e89-b106-3eff3512d31f" | |
26 | |
27 # Code Signing identity - this needs to be set up on the local machine. | |
28 CODE_SIGN_IDENTITY="iPhone Developer: Google Development (3F4Y5873JF)" | |
29 | |
30 IOS_BUNDLE_ID="com.google.iOSShell" | |
31 | |
32 IOS_RESULTS_DIR="results" | |
33 | |
34 if [[ $# -ge 1 ]]; then | |
35 BUILDTYPE=$1 | |
36 fi | |
37 | |
38 set -x | |
39 | |
40 ios_uninstall_app() { | |
41 ideviceinstaller -U "$IOS_BUNDLE_ID" | |
42 } | |
43 | |
44 ios_install_app() { | |
45 rm -rf $IOS_PCKG_DIR | |
46 mkdir -p $IOS_PCKG_DIR/Payload # this directory must be named 'Payload' | |
47 cp -rf "${SKIA_SRC_DIR}/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app" "${IOS_ PCKG_DIR}/Payload/" | |
48 local RET_DIR=`pwd` | |
49 cd $IOS_PCKG_DIR | |
50 zip -r iOSShell.ipa Payload | |
51 ideviceinstaller -i ./iOSShell.ipa | |
52 cd $RET_DIR | |
53 } | |
54 | |
55 ios_clear_docs() { | |
borenet
2015/04/21 13:50:12
We're pretty careful about what we delete and don'
stephana-chromium
2015/04/21 15:06:53
That was left over from some experimentation. Remo
| |
56 ios_mount | |
57 rm -rf "$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_RESOURCE_DIR" | |
58 rm -rf "$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_RESULTS_DIR" | |
59 ios_umount | |
60 } | |
61 | |
62 ios_rmdir() { | |
63 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" | |
64 | |
65 ios_mount | |
66 rm -rf "$TARGET" | |
67 ios_umount | |
68 } | |
69 | |
70 ios_mkdir() { | |
71 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" | |
72 ios_mount | |
73 mkdir -p "$TARGET" | |
74 ios_umount | |
75 } | |
76 | |
77 # ios_mount: mounts the iOS device for reading or writing. | |
78 ios_mount() { | |
79 # If this is already mounted we return. | |
80 if $(mount | grep --quiet "$IOS_MOUNT_POINT"); then | |
81 echo "Device already mounted at: $IOS_MOUNT_POINT - Unmounting." | |
82 ios_umount | |
83 fi | |
84 | |
85 # Ensure there is a mount directory. | |
86 if [[ ! -d "$IOS_MOUNT_POINT" ]]; then | |
87 mkdir -p $IOS_MOUNT_POINT | |
88 fi | |
89 ifuse --container $TEST_RUNNER_BUNDLE_ID $IOS_MOUNT_POINT | |
90 sleep 1 | |
91 echo "Successfully mounted device." | |
92 } | |
93 | |
94 # ios_umount: unmounts the ios device. | |
95 ios_umount() { | |
96 umount $IOS_MOUNT_POINT | |
97 sleep 1 | |
98 } | |
99 | |
100 # ios_restart: restarts the iOS device. | |
101 ios_restart() { | |
102 idevicediagnostics restart | |
103 } | |
104 | |
105 # ios_pull(ios_src, host_dst): Copies the content of ios_src to host_dst. | |
106 # The path is relative to the 'Documents' folder on the device. | |
107 ios_pull() { | |
108 # read input params | |
109 local IOS_SRC="$1" | |
110 local HOST_DST="$2" | |
111 | |
112 ios_mount | |
113 cp -r $IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_SRC $HOST_DST | |
114 ios_umount | |
115 } | |
116 | |
117 # ios_push(host_src, ios_dst) | |
118 ios_push() { | |
119 # read input params | |
120 local HOST_SRC="$1" | |
121 local IOS_DST="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$2" | |
122 | |
123 ios_mount | |
124 rm -rf $IOS_DST | |
125 mkdir -p "$(dirname $IOS_DST)" | |
126 cp -r "$HOST_SRC" "$IOS_DST" | |
127 ios_umount | |
128 } | |
129 | |
130 ios_path_exists() { | |
131 local TARGET_PATH="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" | |
132 local RET=1 | |
133 ios_mount | |
134 if [[ -e $TARGET_PATH ]]; then | |
135 RET=0 | |
136 fi | |
137 ios_umount | |
138 return $RET | |
139 } | |
140 | |
141 # ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` | |
142 # HOST_LS=`ls -ld $HOST_SRC` | |
143 # if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ]; | |
144 # then | |
145 # ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})" | |
146 # fi | |
147 | |
148 | |
149 # ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST` | |
150 # if [ "${ANDROID_LS:0:1}" == "-" ]; then | |
151 # #get the MD5 for dst and src | |
152 # ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST` | |
153 # if [ $(uname) == "Darwin" ]; then | |
154 # HOST_MD5=`md5 -q $HOST_SRC` | |
155 # else | |
156 # HOST_MD5=`md5sum $HOST_SRC` | |
157 # fi | |
158 | |
159 # if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then | |
160 # echo -n "$ANDROID_DST " | |
161 # $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | |
162 # fi | |
163 # elif [ "${ANDROID_LS:0:1}" == "d" ]; then | |
164 # for FILE_ITEM in `ls $HOST_SRC`; do | |
165 # adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITE M}" | |
166 # done | |
167 # else | |
168 # HOST_LS=`ls -ld $HOST_SRC` | |
169 # if [ "${HOST_LS:0:1}" == "d" ]; then | |
170 # $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST | |
171 # adb_push_if_needed $HOST_SRC $ANDROID_DST | |
172 # else | |
173 # echo -n "$ANDROID_DST " | |
174 # $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" | |
175 # $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | |
176 # fi | |
177 # fi | |
178 # } | |
179 | |
180 # setup_device "${DEVICE_ID}" | |
OLD | NEW |