OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 ############################################################################### | 2 ############################################################################### |
3 # Copyright 2015 Google Inc. | 3 # Copyright 2015 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 ############################################################################### | 7 ############################################################################### |
8 # | 8 # |
9 # ios_setup.sh: Sets environment variables used by other iOS scripts. | 9 # ios_setup.sh: Sets environment variables used by other iOS scripts. |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 # Provisioning profile - this needs to be set up on the local machine. | 30 # Provisioning profile - this needs to be set up on the local machine. |
31 PROVISIONING_PROFILE="9e88090d-abed-4e89-b106-3eff3512d31f" | 31 PROVISIONING_PROFILE="9e88090d-abed-4e89-b106-3eff3512d31f" |
32 | 32 |
33 # Code Signing identity - this needs to be set up on the local machine. | 33 # Code Signing identity - this needs to be set up on the local machine. |
34 CODE_SIGN_IDENTITY="iPhone Developer: Google Development (3F4Y5873JF)" | 34 CODE_SIGN_IDENTITY="iPhone Developer: Google Development (3F4Y5873JF)" |
35 | 35 |
36 IOS_BUNDLE_ID="com.google.iOSShell" | 36 IOS_BUNDLE_ID="com.google.iOSShell" |
37 | 37 |
38 IOS_RESULTS_DIR="results" | 38 IOS_RESULTS_DIR="results" |
39 | 39 |
40 if [[ $# -ge 1 ]]; then | |
41 BUILDTYPE=$1 | |
42 fi | |
43 | |
44 set -x | |
45 | 40 |
46 ios_uninstall_app() { | 41 ios_uninstall_app() { |
47 ideviceinstaller -U "$IOS_BUNDLE_ID" | 42 ideviceinstaller -U "$IOS_BUNDLE_ID" |
48 } | 43 } |
49 | 44 |
50 ios_install_app() { | 45 ios_install_app() { |
51 rm -rf $IOS_PCKG_DIR | 46 rm -rf $IOS_PCKG_DIR |
52 mkdir -p $IOS_PCKG_DIR/Payload # this directory must be named 'Payload' | 47 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/" | 48 cp -rf "${SKIA_SRC_DIR}/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app" "${IOS_
PCKG_DIR}/Payload/" |
54 local RET_DIR=`pwd` | 49 local RET_DIR=`pwd` |
55 cd $IOS_PCKG_DIR | 50 cd $IOS_PCKG_DIR |
56 zip -r iOSShell.ipa Payload | 51 zip -r iOSShell.ipa Payload |
57 ideviceinstaller -i ./iOSShell.ipa | 52 ideviceinstaller -i ./iOSShell.ipa |
58 cd $RET_DIR | 53 cd $RET_DIR |
59 } | 54 } |
60 | 55 |
61 ios_rmdir() { | 56 ios_rm() { |
62 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" | 57 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" |
63 | 58 |
64 ios_mount | 59 ios_mount |
65 rm -rf "$TARGET" | 60 rm -rf "$TARGET" |
66 ios_umount | 61 ios_umount |
67 } | 62 } |
68 | 63 |
69 ios_mkdir() { | 64 ios_mkdir() { |
70 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" | 65 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" |
71 ios_mount | 66 ios_mount |
72 mkdir -p "$TARGET" | 67 mkdir -p "$TARGET" |
73 ios_umount | 68 ios_umount |
74 } | 69 } |
75 | 70 |
| 71 ios_cat() { |
| 72 local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" |
| 73 ios_mount |
| 74 RET="$(cat $TARGET)" |
| 75 ios_umount |
| 76 echo -e "$RET" |
| 77 } |
| 78 |
76 # ios_mount: mounts the iOS device for reading or writing. | 79 # ios_mount: mounts the iOS device for reading or writing. |
77 ios_mount() { | 80 ios_mount() { |
78 # If this is already mounted we return. | 81 # If this is already mounted we return. |
79 if $(mount | grep --quiet "$IOS_MOUNT_POINT"); then | 82 if $(mount | grep --quiet "$IOS_MOUNT_POINT"); then |
80 echo "Device already mounted at: $IOS_MOUNT_POINT - Unmounting." | 83 >&2 echo "Device already mounted at: $IOS_MOUNT_POINT - Unmounting." |
81 ios_umount | 84 ios_umount |
82 fi | 85 fi |
83 | 86 |
84 # Ensure there is a mount directory. | 87 # Ensure there is a mount directory. |
85 if [[ ! -d "$IOS_MOUNT_POINT" ]]; then | 88 if [[ ! -d "$IOS_MOUNT_POINT" ]]; then |
86 mkdir -p $IOS_MOUNT_POINT | 89 mkdir -p $IOS_MOUNT_POINT |
87 fi | 90 fi |
88 ifuse --container $TEST_RUNNER_BUNDLE_ID $IOS_MOUNT_POINT | 91 ifuse --container $TEST_RUNNER_BUNDLE_ID $IOS_MOUNT_POINT |
89 sleep 1 | 92 sleep 1 |
90 echo "Successfully mounted device." | 93 >&2 echo "Successfully mounted device." |
91 } | 94 } |
92 | 95 |
93 # ios_umount: unmounts the ios device. | 96 # ios_umount: unmounts the ios device. |
94 ios_umount() { | 97 ios_umount() { |
95 umount $IOS_MOUNT_POINT | 98 umount $IOS_MOUNT_POINT |
96 sleep 1 | 99 sleep 1 |
97 } | 100 } |
98 | 101 |
99 # ios_restart: restarts the iOS device. | 102 # ios_restart: restarts the iOS device. |
100 ios_restart() { | 103 ios_restart() { |
101 idevicediagnostics restart | 104 idevicediagnostics restart |
102 } | 105 } |
103 | 106 |
104 # ios_pull(ios_src, host_dst): Copies the content of ios_src to host_dst. | 107 # 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. | 108 # The path is relative to the 'Documents' folder on the device. |
106 ios_pull() { | 109 ios_pull() { |
107 # read input params | 110 # read input params |
108 local IOS_SRC="$1" | 111 local IOS_SRC="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1" |
109 local HOST_DST="$2" | 112 local HOST_DST="$2" |
110 | 113 |
111 ios_mount | 114 ios_mount |
112 cp -r $IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_SRC $HOST_DST | 115 if [[ -d "${HOST_DST}" ]]; then |
| 116 cp -r "$IOS_SRC/" "$HOST_DST" |
| 117 else |
| 118 cp -r "$IOS_SRC" "$HOST_DST" |
| 119 fi |
113 ios_umount | 120 ios_umount |
114 } | 121 } |
115 | 122 |
116 # ios_push(host_src, ios_dst) | 123 # ios_push(host_src, ios_dst) |
117 ios_push() { | 124 ios_push() { |
118 # read input params | 125 # read input params |
119 local HOST_SRC="$1" | 126 local HOST_SRC="$1" |
120 local IOS_DST="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$2" | 127 local IOS_DST="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$2" |
121 | 128 |
122 ios_mount | 129 ios_mount |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 # adb_push_if_needed $HOST_SRC $ANDROID_DST | 177 # adb_push_if_needed $HOST_SRC $ANDROID_DST |
171 # else | 178 # else |
172 # echo -n "$ANDROID_DST " | 179 # echo -n "$ANDROID_DST " |
173 # $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" | 180 # $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")" |
174 # $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST | 181 # $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST |
175 # fi | 182 # fi |
176 # fi | 183 # fi |
177 # } | 184 # } |
178 | 185 |
179 # setup_device "${DEVICE_ID}" | 186 # setup_device "${DEVICE_ID}" |
OLD | NEW |