| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 # Download the newest version of Closure Compiler, build it and put into Chrome | 6 # Download the newest version of Closure Compiler, build it and put into Chrome |
| 7 # source tree. Also update externs/chrome_extensions.js. | 7 # source tree. Also update externs/chrome_extensions.js. |
| 8 | 8 |
| 9 readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | 9 readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 10 readonly TEMP_DIR=$(mktemp -d) | 10 readonly TEMP_DIR=$(mktemp -d) |
| 11 | 11 |
| 12 cleanup() { | 12 cleanup() { |
| 13 echo "Cleaning up..." |
| 13 rm -rf "${TEMP_DIR}" | 14 rm -rf "${TEMP_DIR}" |
| 14 } | 15 } |
| 15 | 16 |
| 16 trap cleanup SIGINT SIGHUP SIGTERM | 17 trap cleanup SIGINT SIGHUP SIGTERM |
| 17 | 18 |
| 18 cd "${TEMP_DIR}" | 19 cd "${TEMP_DIR}" |
| 19 echo "Cloning Closure Compiler repo" | 20 echo "Cloning Closure Compiler repo" |
| 20 git clone https://github.com/google/closure-compiler.git | 21 git clone https://github.com/google/closure-compiler.git |
| 21 | 22 |
| 22 cd closure-compiler | 23 cd closure-compiler |
| 23 echo "Building Closure Compiler" | 24 echo "Building Closure Compiler" |
| 24 ant jar | 25 ant jar |
| 25 | 26 |
| 26 if [[ "$?" -ne 0 ]]; then | 27 if [[ "$?" -ne 0 ]]; then |
| 27 echo "Failed to build jar, copying nothing" >&2 | 28 echo "Failed to build jar, copying nothing" >&2 |
| 28 cleanup | 29 cleanup |
| 29 exit 1 | 30 exit 1 |
| 30 fi | 31 fi |
| 31 | 32 |
| 32 echo "Copying compiler.jar and chrome_extensions.js" | 33 echo "Copying compiler.jar and chrome_extensions.js" |
| 33 cp build/compiler.jar "${SCRIPT_DIR}/compiler/" | 34 cp build/compiler.jar "${SCRIPT_DIR}/compiler/" |
| 34 cp contrib/externs/chrome_extensions.js "${SCRIPT_DIR}/externs/" | 35 cp contrib/externs/chrome_extensions.js "${SCRIPT_DIR}/externs/" |
| 35 echo "Done" | 36 |
| 37 echo "Rebuilding runner.jar" |
| 38 "${SCRIPT_DIR}/runner/build_runner_jar.py" |
| 39 |
| 36 cleanup | 40 cleanup |
| OLD | NEW |