Revert 275549 "Revert 275154 "ChromeOS login webui refactoring :..."
[chromium-blink-merge.git] / third_party / dom_distiller_js / update_domdistiller_js.sh
blobe6bbf8b5bb4ad01d2394380211bf87229c784891
1 #!/bin/bash
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.
14 dom_distiller_js_path=third_party/dom_distiller_js
15 dom_distiller_js_package=$dom_distiller_js_path/package
16 readme_chromium=$dom_distiller_js_path/README.chromium
17 tmpdir=/tmp/domdistiller-$$
18 changes=$tmpdir/domdistiller.changes
19 bugs=$tmpdir/domdistiller.bugs
20 curr_gitsha=$(grep 'Version:' $readme_chromium | awk '{print $2}')
22 rm -rf $tmpdir
23 mkdir $tmpdir
25 pushd $tmpdir
26 git clone https://code.google.com/p/dom-distiller/ .
28 new_gitsha=$(git rev-parse --short=10 HEAD)
29 git log --oneline ${curr_gitsha}.. > $changes
31 echo -n BUG= > $bugs
33 # This extracts BUG= lines from the log, extracts the numbers part, removes
34 # whitespace and deletes empty lines. Then, split on ',', sort, uniquify and
35 # rejoin. Finally, remove the trailing ',' and concat to $bugs.
36 git log ${curr_gitsha}.. \
37 | grep BUG= \
38 | sed -e 's/.*BUG=\(.*\)/\1/' -e 's/\s*//g' -e '/^$/d' \
39 | tr ',' '\n' \
40 | sort \
41 | uniq \
42 | tr '\n' ',' \
43 | head --bytes=-1 \
44 >> $bugs
46 echo >> $bugs # add a newline
48 ant package
49 popd
51 rm -rf $dom_distiller_js_package
52 mkdir $dom_distiller_js_package
53 cp -rf $tmpdir/out/package/* $dom_distiller_js_package
54 cp $tmpdir/LICENSE $dom_distiller_js_path/
55 sed -i "s/Version: [0-9a-f]*/Version: $new_gitsha/" $readme_chromium
57 echo
58 echo
59 echo "---Generated commit message---"
60 echo
61 echo "Picked up changes:"
62 cat $changes
63 echo
64 cat $bugs
66 # Run checklicenses.py on the pulled files, but only print the output on
67 # failures.
68 tools/checklicenses/checklicenses.py $dom_distiller_js_path > $tmpdir/checklicenses.out || cat $tmpdir/checklicenses.out
70 rm -rf $tmpdir