#!/bin/bash # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # # Download the newest version of Closure Compiler, build it and put into Chrome # source tree. Also update externs/chrome_extensions.js. readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly TEMP_DIR=$(mktemp -d) cleanup() { echo "Cleaning up..." rm -rf "${TEMP_DIR}" } trap cleanup SIGINT SIGHUP SIGTERM cd "${TEMP_DIR}" echo "Cloning Closure Compiler repo" git clone https://github.com/google/closure-compiler.git cd closure-compiler echo "Building Closure Compiler" ant jar if [[ "$?" -ne 0 ]]; then echo "Failed to build jar, copying nothing" >&2 cleanup exit 1 fi echo "Copying compiler.jar and chrome_extensions.js" cp build/compiler.jar "${SCRIPT_DIR}/compiler/" (cat < "${SCRIPT_DIR}/externs/chrome_extensions.js" // SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP // SS:::::::::::::::ST:::::::::::::::::::::T OO:::::::::OO P::::::::::::::::P // S:::::SSSSSS::::::ST:::::::::::::::::::::T OO:::::::::::::OO P::::::PPPPPP:::::P // S:::::S SSSSSSST:::::TT:::::::TT:::::TO:::::::OOO:::::::OPP:::::P P:::::P // S:::::S TTTTTT T:::::T TTTTTTO::::::O O::::::O P::::P P:::::P // S:::::S T:::::T O:::::O O:::::O P::::P P:::::P // S::::SSSS P::::PPPPPP:::::P // SS::::::SSSSS This file is generated. To update it, P:::::::::::::PP // SSS::::::::SS run bump_compiler_version. P::::PPPPPPPPP // SSSSSS::::S P::::P // S:::::S T:::::T O:::::O O:::::O P::::P // S:::::S T:::::T O::::::O O::::::O P::::P // SSSSSSS S:::::S TT:::::::TT O:::::::OOO:::::::OPP::::::PP // S::::::SSSSSS:::::S T:::::::::T OO:::::::::::::OO P::::::::P // S:::::::::::::::SS T:::::::::T OO:::::::::OO P::::::::P // SSSSSSSSSSSSSSS TTTTTTTTTTT OOOOOOOOO PPPPPPPPPP EOT echo "Rebuilding runner.jar" "${SCRIPT_DIR}/runner/build_runner_jar.py" cleanup