| 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 29 matching lines...) Expand all Loading... |
| 40 # $2 and beyond: key value pairs which are parsed by bb_parse_args. | 40 # $2 and beyond: key value pairs which are parsed by bb_parse_args. |
| 41 function bb_baseline_setup { | 41 function bb_baseline_setup { |
| 42 SRC_ROOT="$1" | 42 SRC_ROOT="$1" |
| 43 # Remove SRC_ROOT param | 43 # Remove SRC_ROOT param |
| 44 shift | 44 shift |
| 45 cd $SRC_ROOT | 45 cd $SRC_ROOT |
| 46 | 46 |
| 47 echo "@@@BUILD_STEP Environment setup@@@" | 47 echo "@@@BUILD_STEP Environment setup@@@" |
| 48 bb_parse_args "$@" | 48 bb_parse_args "$@" |
| 49 | 49 |
| 50 local BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | 50 export GYP_GENERATORS=ninja |
| 51 if [[ $BUILDTOOL = ninja ]]; then | |
| 52 export GYP_GENERATORS=ninja | |
| 53 fi | |
| 54 export GOMA_DIR=/b/build/goma | 51 export GOMA_DIR=/b/build/goma |
| 55 . build/android/envsetup.sh | 52 . build/android/envsetup.sh |
| 56 | 53 |
| 57 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ | 54 local extra_gyp_defines="$(bb_get_json_prop "$FACTORY_PROPERTIES" \ |
| 58 extra_gyp_defines)" | 55 extra_gyp_defines)" |
| 59 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" | 56 export GYP_DEFINES+=" fastbuild=1 $extra_gyp_defines" |
| 60 if echo $extra_gyp_defines | grep -qE 'clang|asan'; then | 57 if echo $extra_gyp_defines | grep -qE 'clang|asan'; then |
| 61 unset CXX_target | 58 unset CXX_target |
| 62 fi | 59 fi |
| 63 | 60 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 # crbug.com/145860 | 77 # crbug.com/145860 |
| 81 rm -rf ~/.android | 78 rm -rf ~/.android |
| 82 rm -rf "$build_path" | 79 rm -rf "$build_path" |
| 83 if [[ -e $build_path ]] ; then | 80 if [[ -e $build_path ]] ; then |
| 84 echo "Clobber appeared to fail? $build_path still exists." | 81 echo "Clobber appeared to fail? $build_path still exists." |
| 85 echo "@@@STEP_WARNINGS@@@" | 82 echo "@@@STEP_WARNINGS@@@" |
| 86 fi | 83 fi |
| 87 fi | 84 fi |
| 88 } | 85 } |
| 89 | 86 |
| 90 function bb_compile_setup { | |
| 91 bb_setup_goma_internal | |
| 92 # Should be called only after envsetup is done. | |
| 93 gclient runhooks | |
| 94 } | |
| 95 | |
| 96 function bb_asan_tests_setup { | 87 function bb_asan_tests_setup { |
| 97 # Download or build the ASan runtime library. | 88 # Download or build the ASan runtime library. |
| 98 ${SRC_ROOT}/tools/clang/scripts/update.sh | 89 ${SRC_ROOT}/tools/clang/scripts/update.sh |
| 99 } | 90 } |
| 100 | 91 |
| 101 # Setup goma. Used internally to buildbot_functions.sh. | 92 # Setup goma. Used internally to buildbot_functions.sh. |
| 102 function bb_setup_goma_internal { | 93 function bb_setup_goma_internal { |
| 103 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key | |
| 104 export GOMA_COMPILER_PROXY_DAEMON_MODE=true | |
| 105 export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300 | |
| 106 | |
| 107 echo "Killing old goma processes" | 94 echo "Killing old goma processes" |
| 108 ${GOMA_DIR}/goma_ctl.sh stop || true | 95 ${GOMA_DIR}/goma_ctl.sh stop || true |
| 109 killall -9 compiler_proxy || true | 96 killall -9 compiler_proxy || true |
| 110 | 97 |
| 111 echo "Starting goma" | 98 echo "Starting goma" |
| 99 export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key |
| 112 ${GOMA_DIR}/goma_ctl.sh start | 100 ${GOMA_DIR}/goma_ctl.sh start |
| 113 trap bb_stop_goma_internal SIGHUP SIGINT SIGTERM | 101 trap bb_stop_goma_internal SIGHUP SIGINT SIGTERM |
| 114 } | 102 } |
| 115 | 103 |
| 116 # Stop goma. | 104 # Stop goma. |
| 117 function bb_stop_goma_internal { | 105 function bb_stop_goma_internal { |
| 118 echo "Stopping goma" | 106 echo "Stopping goma" |
| 119 ${GOMA_DIR}/goma_ctl.sh stop | 107 ${GOMA_DIR}/goma_ctl.sh stop |
| 120 } | 108 } |
| 121 | 109 |
| 122 # $@: make args. | |
| 123 # Use goma if possible; degrades to non-Goma if needed. | |
| 124 function bb_goma_make { | |
| 125 if [ "${GOMA_DIR}" = "" ]; then | |
| 126 make -j${JOBS} "$@" | |
| 127 return | |
| 128 fi | |
| 129 | |
| 130 HOST_CC=$GOMA_DIR/gcc | |
| 131 HOST_CXX=$GOMA_DIR/g++ | |
| 132 TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1) | |
| 133 TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1) | |
| 134 TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC" | |
| 135 TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX" | |
| 136 COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \ | |
| 137 -target 1.5 -Xmaxerrs 9999999" | |
| 138 | |
| 139 command make \ | |
| 140 -j100 \ | |
| 141 -l20 \ | |
| 142 HOST_CC="$HOST_CC" \ | |
| 143 HOST_CXX="$HOST_CXX" \ | |
| 144 TARGET_CC="$TARGET_CC" \ | |
| 145 TARGET_CXX="$TARGET_CXX" \ | |
| 146 CC.host="$HOST_CC" \ | |
| 147 CXX.host="$HOST_CXX" \ | |
| 148 CC.target="$TARGET_CC" \ | |
| 149 CXX.target="$TARGET_CXX" \ | |
| 150 LINK.target="$TARGET_CXX" \ | |
| 151 COMMON_JAVAC="$COMMON_JAVAC" \ | |
| 152 BUILDTYPE="$BUILDTYPE" \ | |
| 153 "$@" | |
| 154 | |
| 155 local make_exit_code=$? | |
| 156 return $make_exit_code | |
| 157 } | |
| 158 | |
| 159 # Build using ninja. | 110 # Build using ninja. |
| 160 function bb_goma_ninja { | 111 function bb_goma_ninja { |
| 161 echo "Using ninja to build." | 112 echo "Using ninja to build." |
| 162 local TARGET=$1 | 113 local TARGET=$1 |
| 114 bb_setup_goma_internal |
| 163 ninja -C out/$BUILDTYPE -j120 -l20 $TARGET | 115 ninja -C out/$BUILDTYPE -j120 -l20 $TARGET |
| 116 bb_stop_goma_internal |
| 164 } | 117 } |
| 165 | 118 |
| 166 # Compile step | 119 # Compile step |
| 167 function bb_compile { | 120 function bb_compile { |
| 168 # This must be named 'compile', not 'Compile', for CQ interaction. | 121 # This must be named 'compile' for CQ. |
| 169 # Talk to maruel for details. | |
| 170 echo "@@@BUILD_STEP compile@@@" | 122 echo "@@@BUILD_STEP compile@@@" |
| 171 bb_compile_setup | 123 gclient runhooks |
| 172 | 124 bb_goma_ninja All |
| 173 BUILDTOOL=$(bb_get_json_prop "$FACTORY_PROPERTIES" buildtool) | |
| 174 if [[ $BUILDTOOL = ninja ]]; then | |
| 175 bb_goma_ninja All | |
| 176 else | |
| 177 bb_goma_make | |
| 178 fi | |
| 179 | |
| 180 bb_stop_goma_internal | |
| 181 } | 125 } |
| 182 | 126 |
| 183 # Experimental compile step; does not turn the tree red if it fails. | 127 # Experimental compile step; does not turn the tree red if it fails. |
| 184 function bb_compile_experimental { | 128 function bb_compile_experimental { |
| 185 # Linking DumpRenderTree appears to hang forever? | 129 # Linking DumpRenderTree appears to hang forever? |
| 186 EXPERIMENTAL_TARGETS="android_experimental" | 130 EXPERIMENTAL_TARGETS="android_experimental" |
| 187 for target in ${EXPERIMENTAL_TARGETS} ; do | 131 for target in ${EXPERIMENTAL_TARGETS} ; do |
| 188 echo "@@@BUILD_STEP Experimental Compile $target @@@" | 132 echo "@@@BUILD_STEP Experimental Compile $target @@@" |
| 189 set +e | 133 set +e |
| 190 if [[ $BUILDTOOL = ninja ]]; then | 134 bb_goma_ninja "${target}" |
| 191 bb_goma_ninja "${target}" | |
| 192 else | |
| 193 bb_goma_make -k "${target}" | |
| 194 fi | |
| 195 if [ $? -ne 0 ] ; then | 135 if [ $? -ne 0 ] ; then |
| 196 echo "@@@STEP_WARNINGS@@@" | 136 echo "@@@STEP_WARNINGS@@@" |
| 197 fi | 137 fi |
| 198 set -e | 138 set -e |
| 199 done | 139 done |
| 200 } | 140 } |
| 201 | 141 |
| 202 # Run findbugs. | 142 # Run findbugs. |
| 203 function bb_run_findbugs { | 143 function bb_run_findbugs { |
| 204 echo "@@@BUILD_STEP findbugs@@@" | 144 echo "@@@BUILD_STEP findbugs@@@" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 ) | 219 ) |
| 280 } | 220 } |
| 281 | 221 |
| 282 # Retrieve a packed json property using python | 222 # Retrieve a packed json property using python |
| 283 function bb_get_json_prop { | 223 function bb_get_json_prop { |
| 284 local JSON="$1" | 224 local JSON="$1" |
| 285 local PROP="$2" | 225 local PROP="$2" |
| 286 | 226 |
| 287 python -c "import json; print json.loads('$JSON').get('$PROP', '')" | 227 python -c "import json; print json.loads('$JSON').get('$PROP', '')" |
| 288 } | 228 } |
| OLD | NEW |