OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # Copyright 2012 the V8 project authors. All rights reserved. | 2 # Copyright 2012 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
11 # disclaimer in the documentation and/or other materials provided | 11 # disclaimer in the documentation and/or other materials provided |
12 # with the distribution. | 12 # with the distribution. |
13 # * Neither the name of Google Inc. nor the names of its | 13 # * Neither the name of Google Inc. nor the names of its |
14 # contributors may be used to endorse or promote products derived | 14 # contributors may be used to endorse or promote products derived |
15 # from this software without specific prior written permission. | 15 # from this software without specific prior written permission. |
16 # | 16 # |
17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 19 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 20 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 # Inspired by and based on: | 29 # This script pushes android binaries and test data to the device. |
30 # http://src.chromium.org/viewvc/chrome/trunk/src/tools/bash-completion | 30 # The first argument can be either "android.release" or "android.debug". |
31 # The second argument is a relative path to the output directory with binaries. | |
32 # The third argument is the absolute path to the V8 directory on the host. | |
33 # The fourth argument is the absolute path to the V8 directory on the device. | |
31 | 34 |
32 # Flag completion rule for bash. | 35 ARCH_MODE=$1 |
33 # To load in your shell, "source path/to/this/file". | 36 OUTDIR=$2 |
37 HOST_V8=$3 | |
38 ANDROID_V8=$4 | |
Jakob Kummerow
2012/07/02 14:25:58
How about a check that all arguments are present,
ulan
2012/07/02 16:18:23
Done.
| |
34 | 39 |
35 v8_source=$(readlink -f $(dirname $BASH_SOURCE)/..) | 40 function sync_file { |
36 | 41 local FILE=$1 |
37 _v8_flag() { | 42 local ANDROID_HASH=`adb shell "md5 $ANDROID_V8/$FILE"` |
Jakob Kummerow
2012/07/02 14:25:58
Please use $(...) instead of `...`
ulan
2012/07/02 16:18:23
Done.
| |
38 local cur defines targets | 43 local HOST_HASH=`md5sum $HOST_V8/$FILE` |
Jakob Kummerow
2012/07/02 14:25:58
again $(...)
And if you don't want this to fail h
ulan
2012/07/02 16:18:23
Done.
| |
39 cur="${COMP_WORDS[COMP_CWORD]}" | 44 if [ "${ANDROID_HASH%% *}" != "${HOST_HASH%% *}" ] |
40 defines=$(cat src/flag-definitions.h \ | 45 then |
Jakob Kummerow
2012/07/02 14:25:58
nit: you can put the "then" on the "if"'s line (li
ulan
2012/07/02 16:18:23
Done.
| |
41 | grep "^DEFINE" \ | 46 adb push $HOST_V8/$FILE $ANDROID_V8/$FILE &> /dev/null |
42 | grep -v "DEFINE_implication" \ | 47 fi |
43 | sed -e 's/_/-/g') | |
44 targets=$(echo "$defines" \ | |
45 | sed -ne 's/^DEFINE-[^(]*(\([^,]*\).*/--\1/p'; \ | |
46 echo "$defines" \ | |
47 | sed -ne 's/^DEFINE-bool(\([^,]*\).*/--no\1/p'; \ | |
48 cat src/d8.cc \ | |
49 | grep "strcmp(argv\[i\]" \ | |
50 | sed -ne 's/^[^"]*"--\([^"]*\)".*/--\1/p') | |
51 COMPREPLY=($(compgen -W "$targets" -- "$cur")) | |
52 return 0 | |
53 } | 48 } |
54 | 49 |
55 complete -F _v8_flag -f d8 | 50 function sync_dir { |
51 local DIR=$1 | |
52 echo -n "sync to $ANDROID_V8/$DIR" | |
53 for FILE in `find $HOST_V8/$DIR -type f` | |
Jakob Kummerow
2012/07/02 14:25:58
again $(...)
ulan
2012/07/02 16:18:23
Done.
| |
54 do | |
Jakob Kummerow
2012/07/02 14:25:58
nit: again, for consistency with '{', I suggest re
ulan
2012/07/02 16:18:23
Done.
| |
55 local RELATIVE_FILE=${FILE:${#HOST_V8}} | |
56 sync_file $RELATIVE_FILE | |
57 echo -n "." | |
Jakob Kummerow
2012/07/02 14:25:58
How about moving this line into sync_file and remo
ulan
2012/07/02 16:18:23
Done.
| |
58 done | |
59 echo "" | |
60 } | |
61 | |
62 echo -n "sync to $ANDROID_V8/$OUTDIR/$ARCH_MODE" | |
63 sync_file $OUTDIR/$ARCH_MODE/cctest | |
64 echo -n "." | |
65 sync_file $OUTDIR/$ARCH_MODE/d8 | |
66 echo -n "." | |
67 sync_file $OUTDIR/$ARCH_MODE/preparser | |
68 echo -n "." | |
69 sync_file $OUTDIR/$ARCH_MODE/process | |
Jakob Kummerow
2012/07/02 14:25:58
I don't think the "process" binary is required for
ulan
2012/07/02 16:18:23
Done.
| |
70 echo -n "." | |
71 sync_file $OUTDIR/$ARCH_MODE/shell | |
Jakob Kummerow
2012/07/02 14:25:58
"shell" is not required.
ulan
2012/07/02 16:18:23
Done.
| |
72 echo "." | |
73 echo -n "sync to $ANDROID_V8/tools" | |
74 sync_file tools/consarray.js | |
75 echo -n "." | |
76 sync_file tools/codemap.js | |
77 echo -n "." | |
78 sync_file tools/csvparser.js | |
79 echo -n "." | |
80 sync_file tools/profile.js | |
81 echo -n "." | |
82 sync_file tools/splaytree.js | |
83 echo "." | |
84 sync_dir test/mjsunit | |
85 sync_dir test/preparser | |
86 sync_dir test/stress | |
Jakob Kummerow
2012/07/02 14:25:58
I don't think test/stress is part of a regular V8
ulan
2012/07/02 16:18:23
Done.
| |
OLD | NEW |