OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 # This a simple script to make building/testing Mojo components easier (on | 6 # This a simple script to make building/testing Mojo components easier (on |
7 # Linux). | 7 # Linux). |
8 | 8 |
9 # TODO(vtl): Maybe make the test runner smart and not run unchanged test | 9 # TODO(vtl): Maybe make the test runner smart and not run unchanged test |
10 # binaries. | 10 # binaries. |
(...skipping 14 matching lines...) Expand all Loading... |
25 show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do: | 25 show-bash-alias - Outputs an appropriate bash alias for mojob. In bash do: |
26 \$ eval \`mojo/tools/mojob.sh show-bash-alias\` | 26 \$ eval \`mojo/tools/mojob.sh show-bash-alias\` |
27 | 27 |
28 option (which will only apply to commands which follow) should be one of: | 28 option (which will only apply to commands which follow) should be one of: |
29 General options (specify before everything): | 29 General options (specify before everything): |
30 --debug / --release - Debug (default) / Release build. | 30 --debug / --release - Debug (default) / Release build. |
31 gn options (specify before gn): | 31 gn options (specify before gn): |
32 --clang / --gcc - Use clang (default) / gcc. | 32 --clang / --gcc - Use clang (default) / gcc. |
33 --goma / --no-goma - Use goma (if \$GOMA_DIR is set or \$HOME/goma exists; | 33 --goma / --no-goma - Use goma (if \$GOMA_DIR is set or \$HOME/goma exists; |
34 default) / don't use goma. | 34 default) / don't use goma. |
| 35 --with-dart - Configure the Dart bindings. |
35 | 36 |
36 Note: It will abort on the first failure (if any). | 37 Note: It will abort on the first failure (if any). |
37 EOF | 38 EOF |
38 } | 39 } |
39 | 40 |
40 get_gn_arg_value() { | 41 get_gn_arg_value() { |
41 grep -m 1 "^[[:space:]]*\<$2\>" "$1/args.gn" | \ | 42 grep -m 1 "^[[:space:]]*\<$2\>" "$1/args.gn" | \ |
42 sed -n 's/.* = "\?\([^"]*\)"\?$/\1/p' | 43 sed -n 's/.* = "\?\([^"]*\)"\?$/\1/p' |
43 } | 44 } |
44 | 45 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 } | 88 } |
88 | 89 |
89 do_skytests() { | 90 do_skytests() { |
90 local out_dir=$(get_outdir $1) | 91 local out_dir=$(get_outdir $1) |
91 if [ $TARGET == linux ]; then | 92 if [ $TARGET == linux ]; then |
92 ./testing/xvfb.py "${out_dir}" sky/tools/test_sky -t $1 \ | 93 ./testing/xvfb.py "${out_dir}" sky/tools/test_sky -t $1 \ |
93 --no-new-test-results --no-show-results --verbose || exit 1 | 94 --no-new-test-results --no-show-results --verbose || exit 1 |
94 fi | 95 fi |
95 } | 96 } |
96 | 97 |
| 98 do_darttests() { |
| 99 echo "Running dart tests in out/$1 ..." |
| 100 dart mojo/tools/dart_test_runner.dart out/$1/gen || exit 1 |
| 101 } |
| 102 |
97 do_gn() { | 103 do_gn() { |
98 local gn_args="$(make_gn_args $1)" | 104 local gn_args="$(make_gn_args $1)" |
99 local out_dir="$(get_outdir $1)" | 105 local out_dir="$(get_outdir $1)" |
100 echo "Running gn gen ${out_dir} with --args=\"${gn_args}\" ..." | 106 echo "Running gn gen ${out_dir} with --args=\"${gn_args}\" ..." |
101 gn gen --args="${gn_args}" "${out_dir}" | 107 gn gen --args="${gn_args}" "${out_dir}" |
102 } | 108 } |
103 | 109 |
104 do_sync() { | 110 do_sync() { |
105 gclient sync || exit 1 | 111 gclient sync || exit 1 |
106 } | 112 } |
107 | 113 |
108 # Valid values: Debug or Release. | 114 # Valid values: Debug or Release. |
109 BUILD_TYPE=Debug | 115 BUILD_TYPE=Debug |
110 # Valid values: clang or gcc. | 116 # Valid values: clang or gcc. |
111 COMPILER=clang | 117 COMPILER=clang |
112 # Valid values: linux, android or chromeos | 118 # Valid values: linux, android or chromeos |
113 TARGET=linux | 119 TARGET=linux |
114 # Valid values: auto or disabled. | 120 # Valid values: auto or disabled. |
115 GOMA=auto | 121 GOMA=auto |
| 122 # Whether the Dart bindings should be built. |
| 123 DART=disabled |
116 make_gn_args() { | 124 make_gn_args() { |
117 local args=() | 125 local args=() |
118 # TODO(vtl): It's a bit of a hack to infer the build type from the output | 126 # TODO(vtl): It's a bit of a hack to infer the build type from the output |
119 # directory name, but it's what we have right now (since we support "debug and | 127 # directory name, but it's what we have right now (since we support "debug and |
120 # release" mode). | 128 # release" mode). |
121 case "$1" in | 129 case "$1" in |
122 Debug) | 130 Debug) |
123 args+=("is_debug=true") | 131 args+=("is_debug=true") |
124 ;; | 132 ;; |
125 Release) | 133 Release) |
(...skipping 15 matching lines...) Expand all Loading... |
141 elif [ -d "${HOME}/goma" ]; then | 149 elif [ -d "${HOME}/goma" ]; then |
142 args+=("use_goma=true" "goma_dir=\"${HOME}/goma\"") | 150 args+=("use_goma=true" "goma_dir=\"${HOME}/goma\"") |
143 else | 151 else |
144 args+=("use_goma=false") | 152 args+=("use_goma=false") |
145 fi | 153 fi |
146 ;; | 154 ;; |
147 disabled) | 155 disabled) |
148 args+=("use_goma=false") | 156 args+=("use_goma=false") |
149 ;; | 157 ;; |
150 esac | 158 esac |
| 159 case "$DART" in |
| 160 enabled) |
| 161 args+=("mojo_use_dart=true") |
| 162 ;; |
| 163 esac |
151 case "$TARGET" in | 164 case "$TARGET" in |
152 android) | 165 android) |
153 args+=("os=\"android\"" "cpu_arch=\"arm\"") | 166 args+=("os=\"android\"" "cpu_arch=\"arm\"") |
154 ;; | 167 ;; |
155 chromeos) | 168 chromeos) |
156 args+=("os=\"chromeos\"" "ui_base_build_ime=false" \ | 169 args+=("os=\"chromeos\"" "ui_base_build_ime=false" \ |
157 "use_system_harfbuzz=false") | 170 "use_system_harfbuzz=false") |
158 ;; | 171 ;; |
159 esac | 172 esac |
160 echo "${args[*]}" | 173 echo "${args[*]}" |
(...skipping 21 matching lines...) Expand all Loading... |
182 do_unittests "$BUILD_TYPE" | 195 do_unittests "$BUILD_TYPE" |
183 do_pytests "$BUILD_TYPE" | 196 do_pytests "$BUILD_TYPE" |
184 do_skytests "$BUILD_TYPE" | 197 do_skytests "$BUILD_TYPE" |
185 ;; | 198 ;; |
186 perftest) | 199 perftest) |
187 do_perftests "$BUILD_TYPE" | 200 do_perftests "$BUILD_TYPE" |
188 ;; | 201 ;; |
189 pytest) | 202 pytest) |
190 do_pytests "$BUILD_TYPE" | 203 do_pytests "$BUILD_TYPE" |
191 ;; | 204 ;; |
| 205 darttest) |
| 206 do_darttests "$BUILD_TYPE" |
| 207 ;; |
192 gn) | 208 gn) |
193 do_gn "$BUILD_TYPE" | 209 do_gn "$BUILD_TYPE" |
194 ;; | 210 ;; |
195 sync) | 211 sync) |
196 do_sync | 212 do_sync |
197 ;; | 213 ;; |
198 show-bash-alias) | 214 show-bash-alias) |
199 # You want to type something like: | 215 # You want to type something like: |
200 # alias mojob=\ | 216 # alias mojob=\ |
201 # '"$(pwd | sed '"'"'s/\(.*\/src\).*/\1/'"'"')/mojo/tools/mojob.sh"' | 217 # '"$(pwd | sed '"'"'s/\(.*\/src\).*/\1/'"'"')/mojo/tools/mojob.sh"' |
(...skipping 14 matching lines...) Expand all Loading... |
216 ;; | 232 ;; |
217 --gcc) | 233 --gcc) |
218 COMPILER=gcc | 234 COMPILER=gcc |
219 ;; | 235 ;; |
220 --goma) | 236 --goma) |
221 GOMA=auto | 237 GOMA=auto |
222 ;; | 238 ;; |
223 --no-goma) | 239 --no-goma) |
224 GOMA=disabled | 240 GOMA=disabled |
225 ;; | 241 ;; |
| 242 --with-dart) |
| 243 DART=enabled |
| 244 ;; |
226 --android) | 245 --android) |
227 TARGET=android | 246 TARGET=android |
228 COMPILER=gcc | 247 COMPILER=gcc |
229 ;; | 248 ;; |
230 --chromeos) | 249 --chromeos) |
231 TARGET=chromeos | 250 TARGET=chromeos |
232 ;; | 251 ;; |
233 *) | 252 *) |
234 echo "Unknown command \"${arg}\". Try \"$(basename "$0") help\"." | 253 echo "Unknown command \"${arg}\". Try \"$(basename "$0") help\"." |
235 exit 1 | 254 exit 1 |
236 ;; | 255 ;; |
237 esac | 256 esac |
238 done | 257 done |
239 | 258 |
240 exit 0 | 259 exit 0 |
OLD | NEW |