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