| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 # | 5 # |
| 6 # Bash functions used by buildbot annotator scripts for the android | 6 # Bash functions used by buildbot annotator scripts for the android |
| 7 # build of chromium. Executing this script should not perform actions | 7 # build of chromium. Executing this script should not perform actions |
| 8 # other than setting variables and defining of functions. | 8 # other than setting variables and defining of functions. |
| 9 | 9 |
| 10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" | 10 # Number of jobs on the compile line; e.g. make -j"${JOBS}" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 cd $SRC_ROOT | 53 cd $SRC_ROOT |
| 54 | 54 |
| 55 if [ ! -f build/android/envsetup.sh ] ; then | 55 if [ ! -f build/android/envsetup.sh ] ; then |
| 56 echo "No envsetup.sh" | 56 echo "No envsetup.sh" |
| 57 echo "@@@STEP_FAILURE@@@" | 57 echo "@@@STEP_FAILURE@@@" |
| 58 return 1 | 58 return 1 |
| 59 fi | 59 fi |
| 60 | 60 |
| 61 echo "@@@BUILD_STEP Basic setup@@@" | 61 echo "@@@BUILD_STEP Basic setup@@@" |
| 62 bb_setup_environment | 62 bb_setup_environment |
| 63 for mandatory_directory in "${ANDROID_SDK_ROOT}" "${ANDROID_NDK_ROOT}" ; do | 63 |
| 64 for mandatory_directory in $(dirname "${ANDROID_SDK_ROOT}") \ |
| 65 $(dirname "${ANDROID_NDK_ROOT}") ; do |
| 64 if [[ ! -d "${mandatory_directory}" ]]; then | 66 if [[ ! -d "${mandatory_directory}" ]]; then |
| 65 echo "Directory ${mandatory_directory} does not exist." | 67 echo "Directory ${mandatory_directory} does not exist." |
| 66 echo "Build cannot continue." | 68 echo "Build cannot continue." |
| 67 echo "@@@STEP_FAILURE@@@" | 69 echo "@@@STEP_FAILURE@@@" |
| 68 return 1 | 70 return 1 |
| 69 fi | 71 fi |
| 70 done | 72 done |
| 71 | 73 |
| 72 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then | 74 if [ ! "$BUILDBOT_CLOBBER" = "" ]; then |
| 73 NEED_CLOBBER=1 | 75 NEED_CLOBBER=1 |
| 74 fi | 76 fi |
| 75 | 77 |
| 78 # Setting up a new bot? Must do this before envsetup.sh |
| 79 if [ ! -d "${ANDROID_NDK_ROOT}" ] ; then |
| 80 bb_install_build_deps $1 |
| 81 fi |
| 82 |
| 76 echo "@@@BUILD_STEP Configure with envsetup.sh@@@" | 83 echo "@@@BUILD_STEP Configure with envsetup.sh@@@" |
| 77 . build/android/envsetup.sh | 84 . build/android/envsetup.sh |
| 78 | 85 |
| 79 if [ "$NEED_CLOBBER" -eq 1 ]; then | 86 if [ "$NEED_CLOBBER" -eq 1 ]; then |
| 80 echo "@@@BUILD_STEP Clobber@@@" | 87 echo "@@@BUILD_STEP Clobber@@@" |
| 81 rm -rf "${SRC_ROOT}"/out | 88 rm -rf "${SRC_ROOT}"/out |
| 82 if [ -e "${SRC_ROOT}"/out ] ; then | 89 if [ -e "${SRC_ROOT}"/out ] ; then |
| 83 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." | 90 echo "Clobber appeared to fail? ${SRC_ROOT}/out still exists." |
| 84 echo "@@@STEP_WARNINGS@@@" | 91 echo "@@@STEP_WARNINGS@@@" |
| 85 fi | 92 fi |
| 86 fi | 93 fi |
| 87 | 94 |
| 88 echo "@@@BUILD_STEP android_gyp@@@" | 95 echo "@@@BUILD_STEP android_gyp@@@" |
| 89 android_gyp | 96 android_gyp |
| 90 } | 97 } |
| 91 | 98 |
| 92 | 99 |
| 93 # Setup goma. Used internally to buildbot_functions.sh. | 100 # Setup goma. Used internally to buildbot_functions.sh. |
| 94 function bb_setup_goma_internal { | 101 function bb_setup_goma_internal { |
| 102 |
| 103 # Quick bail if I messed things up and can't wait for the CQ to |
| 104 # flush out. |
| 105 # TODO(jrg): remove this condition when things are |
| 106 # proven stable (4/1/12 or so). |
| 107 if [ -f /usr/local/google/DISABLE_GOMA ]; then |
| 108 echo "@@@STEP_WARNINGS@@@" |
| 109 echo "Goma disabled with a local file" |
| 110 return |
| 111 fi |
| 112 |
| 113 goma_dir=${goma_dir:-/b/build/goma} |
| 114 if [ -f ${goma_dir}/goma.key ]; then |
| 115 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key |
| 116 fi |
| 95 local goma_ctl=$(which goma_ctl.sh) | 117 local goma_ctl=$(which goma_ctl.sh) |
| 96 if [ "${goma_ctl}" != "" ]; then | 118 if [ "${goma_ctl}" != "" ]; then |
| 97 local goma_dir=$(dirname ${goma_ctl}) | 119 local goma_dir=$(dirname ${goma_ctl}) |
| 98 fi | 120 fi |
| 99 goma_dir=${goma_dir:-/b/build/goma} | |
| 100 | 121 |
| 101 if [ ! -f ${goma_dir}/goma_ctl.sh ]; then | 122 if [ ! -f ${goma_dir}/goma_ctl.sh ]; then |
| 102 echo "@@@STEP_WARNINGS@@@" | 123 echo "@@@STEP_WARNINGS@@@" |
| 103 echo "Goma not found on this machine; defaulting to make" | 124 echo "Goma not found on this machine; defaulting to make" |
| 104 return | 125 return |
| 105 fi | 126 fi |
| 106 export GOMA_DIR=${goma_dir} | 127 export GOMA_DIR=${goma_dir} |
| 107 echo "GOMA_DIR: " $GOMA_DIR | 128 echo "GOMA_DIR: " $GOMA_DIR |
| 108 | 129 |
| 109 ${GOMA_DIR}/goma_ctl.sh start | |
| 110 if [ -f ${goma_dir}/goma.key ]; then | |
| 111 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | |
| 112 fi | |
| 113 export GOMA_COMPILER_PROXY_DAEMON_MODE=true | 130 export GOMA_COMPILER_PROXY_DAEMON_MODE=true |
| 114 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 | 131 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 |
| 115 export PATH=$GOMA_DIR:$PATH | 132 export PATH=$GOMA_DIR:$PATH |
| 133 |
| 134 echo "Starting goma" |
| 135 if [ "$NEED_CLOBBER" -eq 1 ]; then |
| 136 ${GOMA_DIR}/goma_ctl.sh restart |
| 137 else |
| 138 ${GOMA_DIR}/goma_ctl.sh ensure_start |
| 139 fi |
| 140 trap bb_stop_goma_internal SIGHUP SIGINT SIGTERM |
| 141 } |
| 142 |
| 143 # Stop goma. |
| 144 function bb_stop_goma_internal { |
| 145 echo "Stopping goma" |
| 146 ${GOMA_DIR}/goma_ctl.sh stop |
| 116 } | 147 } |
| 117 | 148 |
| 118 # $@: make args. | 149 # $@: make args. |
| 119 # Use goma if possible; degrades to non-Goma if needed. | 150 # Use goma if possible; degrades to non-Goma if needed. |
| 120 function bb_goma_make { | 151 function bb_goma_make { |
| 121 # Disable Goma | |
| 122 # Seems to work on "Android FYI" | |
| 123 # http://build.chromium.org/p/chromium.fyi/builders/Chromium%20Linux%20Androi
d/builds/6421/steps/Compile/logs/stdio | |
| 124 # and Linux trybots | |
| 125 # http://build.chromium.org/p/chromium/builders/Linux%20x64/builds/23995/step
s/compile/logs/stdio | |
| 126 # But not on Android trybots? | |
| 127 # http://build.chromium.org/p/tryserver.chromium/builders/android/builds/2136
/steps/Compile/logs/stdio | |
| 128 make -j${JOBS} "$@" | |
| 129 return | |
| 130 | |
| 131 # TODO(bulach): to use goma, we need to: | |
| 132 # GOMA_DIR=... android_gyp | |
| 133 # PATH=$GOMA_DIR:$PATH make -j${JOBS} "$@" | |
| 134 bb_setup_goma_internal | 152 bb_setup_goma_internal |
| 135 | 153 |
| 136 if [ "${GOMA_DIR}" = "" ]; then | 154 if [ "${GOMA_DIR}" = "" ]; then |
| 137 make -j${JOBS} "$@" | 155 make -j${JOBS} "$@" |
| 138 return | 156 return |
| 139 fi | 157 fi |
| 140 | 158 |
| 141 HOST_CC=$GOMA_DIR/gcc | 159 HOST_CC=$GOMA_DIR/gcc |
| 142 HOST_CXX=$GOMA_DIR/g++ | 160 HOST_CXX=$GOMA_DIR/g++ |
| 143 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) | 161 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) |
| 144 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) | 162 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) |
| 145 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" | 163 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" |
| 146 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" | 164 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" |
| 147 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ | 165 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ |
| 148 -target 1.5 -Xmaxerrs 9999999" | 166 -target 1.5 -Xmaxerrs 9999999" |
| 149 | 167 |
| 150 make \ | 168 command make \ |
| 151 -j100 \ | 169 -j100 \ |
| 152 -l20 \ | 170 -l20 \ |
| 153 HOST_CC="$HOST_CC" \ | 171 HOST_CC="$HOST_CC" \ |
| 154 HOST_CXX="$HOST_CXX" \ | 172 HOST_CXX="$HOST_CXX" \ |
| 155 TARGET_CC="$TARGET_CC" \ | 173 TARGET_CC="$TARGET_CC" \ |
| 156 TARGET_CXX="$TARGET_CXX" \ | 174 TARGET_CXX="$TARGET_CXX" \ |
| 157 CC.host="$HOST_CC" \ | 175 CC.host="$HOST_CC" \ |
| 158 CXX.host="$HOST_CXX" \ | 176 CXX.host="$HOST_CXX" \ |
| 159 CC.target="$TARGET_CC" \ | 177 CC.target="$TARGET_CC" \ |
| 160 CXX.target="$TARGET_CXX" \ | 178 CXX.target="$TARGET_CXX" \ |
| 161 LINK.target="$TARGET_CXX" \ | 179 LINK.target="$TARGET_CXX" \ |
| 162 COMMON_JAVAC="$COMMON_JAVAC" \ | 180 COMMON_JAVAC="$COMMON_JAVAC" \ |
| 163 "$@" | 181 "$@" |
| 182 |
| 183 bb_stop_goma_internal |
| 164 } | 184 } |
| 165 | 185 |
| 166 # Compile step | 186 # Compile step |
| 167 function bb_compile { | 187 function bb_compile { |
| 168 echo "@@@BUILD_STEP Compile@@@" | 188 echo "@@@BUILD_STEP Compile@@@" |
| 169 bb_goma_make | 189 bb_goma_make |
| 170 } | 190 } |
| 171 | 191 |
| 172 # Experimental compile step; does not turn the tree red if it fails. | 192 # Experimental compile step; does not turn the tree red if it fails. |
| 173 function bb_compile_experimental { | 193 function bb_compile_experimental { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 188 function bb_run_tests_emulator { | 208 function bb_run_tests_emulator { |
| 189 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" | 209 echo "@@@BUILD_STEP Run Tests on an Emulator@@@" |
| 190 build/android/run_tests.py -e --xvfb --verbose | 210 build/android/run_tests.py -e --xvfb --verbose |
| 191 } | 211 } |
| 192 | 212 |
| 193 # Run tests on an actual device. (Better have one plugged in!) | 213 # Run tests on an actual device. (Better have one plugged in!) |
| 194 function bb_run_tests { | 214 function bb_run_tests { |
| 195 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" | 215 echo "@@@BUILD_STEP Run Tests on actual hardware@@@" |
| 196 build/android/run_tests.py --xvfb --verbose | 216 build/android/run_tests.py --xvfb --verbose |
| 197 } | 217 } |
| OLD | NEW |