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