3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
8 # Clones the dom-distiller repo, compiles and extracts its javascript Then
9 # copies that js into the Chromium tree.
10 # This script should be run from the src/ directory and requires that ant is
11 # installed. It takes an optional parameter for which SHA1 to roll to. If left
12 # unspecified the script rolls to HEAD.
17 dom_distiller_js_path
=third_party
/dom_distiller_js
18 dom_distiller_js_package
=$dom_distiller_js_path/package
19 readme_chromium
=$dom_distiller_js_path/README.chromium
20 tmpdir
=/tmp
/domdistiller-$$
21 changes
=$tmpdir/domdistiller.changes
22 bugs
=$tmpdir/domdistiller.bugs
23 curr_gitsha
=$
(grep 'Version:' $readme_chromium |
awk '{print $2}')
29 git clone https
://github.com
/chromium
/dom-distiller
/ .
31 # The new git SHA1 is HEAD or the first command line parameter.
32 [[ -z "$1" ]] && gitsha_target
="HEAD" || gitsha_target
="$1"
33 new_gitsha
=$
(git rev-parse
--short=10 ${gitsha_target})
34 git
reset --hard ${new_gitsha}
35 git log
--oneline ${curr_gitsha}..
${new_gitsha} > $changes
39 # This extracts BUG= lines from the log, extracts the numbers part, removes
40 # whitespace and deletes empty lines. Then, split on ',', sort, uniquify and
41 # rejoin. Finally, remove the trailing ',' and concat to $bugs.
42 git log
${curr_gitsha}..
${new_gitsha} \
44 |
sed -e 's/.*BUG=\(.*\)/\1/' -e 's/\s*//g' -e '/^$/d' \
52 echo >> $bugs # add a newline
57 rm -rf $dom_distiller_js_package
58 mkdir
$dom_distiller_js_package
59 cp -rf $tmpdir/out
/package
/* $dom_distiller_js_package
60 git add
$dom_distiller_js_package
61 cp $tmpdir/LICENSE
$dom_distiller_js_path/
62 sed -i "s/Version: [0-9a-f]*/Version: $new_gitsha/" $readme_chromium
65 echo "Roll DomDistillerJS"
67 echo "Picked up changes:"
73 message
=$tmpdir/message
74 gen_message
> $message
76 # Run checklicenses.py on the pulled files, but only print the output on
78 tools
/checklicenses
/checklicenses.py
$dom_distiller_js_path > $tmpdir/checklicenses.out ||
cat $tmpdir/checklicenses.out
80 git commit
-a -F $message