Roll src/third_party/WebKit a3b4a2e:7441784 (svn 202551:202552)
[chromium-blink-merge.git] / third_party / closure_compiler / build_and_run_tests
bloba25348d7764439423cebf0facd261b56f3309fa6
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 # Downloads and compiles necessary dependencies (closure compiler, junit) and
7 # builds and runs Java-specific JUnit tests.
9 readonly SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
10 readonly TEMP_DIR=$(mktemp -d)
12 cleanup() {
13 rm -rf "${TEMP_DIR}"
14 rm -rf ${SCRIPT_DIR}/runner/*/com/google/javascript/jscomp/*.class
17 die_earlier() {
18 cleanup
19 exit 1
22 trap die_earlier SIGINT SIGHUP SIGTERM
24 cd "${TEMP_DIR}"
25 echo "Cloning Closure Compiler repo"
26 git clone https://github.com/google/closure-compiler.git || die_earlier
28 cd closure-compiler
29 echo "Building Closure Compiler"
30 ant all-classes-jar || die_earlier
32 readonly classpath=".:./runner/test:./runner/src:\
33 ${TEMP_DIR}/closure-compiler/build/compiler.jar:\
34 ${TEMP_DIR}/closure-compiler/build/classes:\
35 ${TEMP_DIR}/closure-compiler/lib/junit.jar"
37 cd "${SCRIPT_DIR}"
39 echo "Compiling tests"
40 javac -classpath "${classpath}" \
41 runner/test/com/google/javascript/jscomp/ChromePassTest.java || die_earlier
43 echo "Running tests"
44 java -classpath "${classpath}" org.junit.runner.JUnitCore \
45 com.google.javascript.jscomp.ChromePassTest || die_earlier
47 echo "Cleaning up"
48 cleanup