cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / third_party / closure_compiler / bump_compiler_version
blob01dc4092a44fb67c876b97de6dd641de33f510fd
1 #!/bin/bash
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
6 # Download the newest version of Closure Compiler, build it and put into Chrome
7 # source tree. Also update externs/chrome_extensions.js.
9 readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10 readonly TEMP_DIR=$(mktemp -d)
12 readonly COMPILER_PATH="${SCRIPT_DIR}/compiler/compiler.jar"
13 readonly EXTERNS_PATH="${SCRIPT_DIR}/externs/chrome_extensions.js"
15 cleanup() {
16 rm -rf "${TEMP_DIR}"
19 get_compiler_version() {
20 java -jar "${1}" --version | grep ^Version: | cut -d' ' -f2
23 get_externs_sha1() {
24 sha1sum "${EXTERNS_PATH}" | cut -d' ' -f1
27 trap cleanup SIGINT SIGHUP SIGTERM
29 previous_compiler_version=$(get_compiler_version ${COMPILER_PATH})
30 previous_externs_sha1=$(get_externs_sha1)
32 cd "${TEMP_DIR}"
33 echo "Cloning Closure Compiler repo"
34 git clone https://github.com/google/closure-compiler.git
36 cd closure-compiler
37 echo "Building Closure Compiler"
38 ant jar
40 if [[ "$?" -ne 0 ]]; then
41 echo "Failed to build jar, copying nothing" >&2
42 cleanup
43 exit 1
46 new_compiler_version=$(get_compiler_version "build/compiler.jar")
48 if [[ "${new_compiler_version}" != "${previous_compiler_version}" ]]; then
49 cp build/compiler.jar "${COMPILER_PATH}"
51 echo "Compiler version changed; re-building runner.jar"
52 "${SCRIPT_DIR}/runner/build_runner_jar.py"
53 if [[ "$?" -ne 0 ]]; then
54 echo "Failed to build runner.jar, roll unsuccessful"
55 cleanup
56 exit 1
59 compiler_jar_range="compiler.jar: ${previous_compiler_version} -> ${new_compiler_version}"
62 (cat <<EOT && cat contrib/externs/chrome_extensions.js) > "${EXTERNS_PATH}"
63 // SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP
64 // SS:::::::::::::::ST:::::::::::::::::::::T OO:::::::::OO P::::::::::::::::P
65 // S:::::SSSSSS::::::ST:::::::::::::::::::::T OO:::::::::::::OO P::::::PPPPPP:::::P
66 // S:::::S SSSSSSST:::::TT:::::::TT:::::TO:::::::OOO:::::::OPP:::::P P:::::P
67 // S:::::S TTTTTT T:::::T TTTTTTO::::::O O::::::O P::::P P:::::P
68 // S:::::S T:::::T O:::::O O:::::O P::::P P:::::P
69 // S::::SSSS P::::PPPPPP:::::P
70 // SS::::::SSSSS This file is generated. To update it, P:::::::::::::PP
71 // SSS::::::::SS run bump_compiler_version. P::::PPPPPPPPP
72 // SSSSSS::::S P::::P
73 // S:::::S T:::::T O:::::O O:::::O P::::P
74 // S:::::S T:::::T O::::::O O::::::O P::::P
75 // SSSSSSS S:::::S TT:::::::TT O:::::::OOO:::::::OPP::::::PP
76 // S::::::SSSSSS:::::S T:::::::::T OO:::::::::::::OO P::::::::P
77 // S:::::::::::::::SS T:::::::::T OO:::::::::OO P::::::::P
78 // SSSSSSSSSSSSSSS TTTTTTTTTTT OOOOOOOOO PPPPPPPPPP
79 EOT
81 new_externs_sha1=$(get_externs_sha1)
83 if [[ "${new_externs_sha1}" != "${previous_externs_sha1}" ]]; then
84 chrome_extensions_range="chrome_extensions.js: ${previous_externs_sha1} -> ${new_externs_sha1}"
87 echo
88 echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
89 echo "@"
90 echo "@ ROLL RESULTS:"
91 echo "@"
92 echo "@ Compiler version:"
93 echo "@ Previous: ${previous_compiler_version}"
94 echo "@ New: ${new_compiler_version}"
95 echo "@"
96 echo "@ Externs SHA1:"
97 echo "@ Previous: ${previous_externs_sha1}"
98 echo "@ New: ${new_externs_sha1}"
99 echo "@"
100 echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
101 echo
103 if [[ -z "${compiler_jar_range}" ]] && [[ -z "${chrome_extensions_range}" ]]; then
104 echo "Nothing to update"
105 else
106 echo "git commit -a -m 'Bumping closure compiler:"
107 echo
108 if [[ ! -z "${compiler_jar_range}" ]]; then echo "${compiler_jar_range}"; fi
109 if [[ ! -z "${chrome_extensions_range}" ]]; then echo "${chrome_extensions_range}"; fi
110 echo "TBR="
111 echo "BUG='"
112 echo
113 echo "git cl upload"
116 cleanup