Chromium Code Reviews| 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 # TODO(dbeam): we don't really need to build the compiler any more. We used to | 9 # TODO(dbeam): we don't really need to build the compiler any more. We used to |
| 10 # need to because we built a custom runner. We could probably just curl | 10 # need to because we built a custom runner. We could probably just curl |
| 11 # https://dl.google.com/closure-compiler/compiler-latest.zip and unzip. And get | 11 # https://dl.google.com/closure-compiler/compiler-latest.zip and unzip. And get |
| 12 # the externs from rawgit.com. | 12 # the externs from rawgit.com. |
| 13 | 13 |
| 14 java -version 2>&1 | head -1 | egrep -q '\b1\.7' | |
| 15 if [[ $? -ne 0 ]]; then | |
| 16 echo "This script requires Java 1.7" >&2 | |
| 17 exit 1 | |
| 18 fi | |
| 19 | |
| 20 javac -version 2>&1 | egrep -q '\b1\.7' | |
| 21 if [[ $? -ne 0 ]]; then | |
| 22 echo "This script requires JDK 1.7" >&2 | |
| 23 exit 1 | |
| 24 fi | |
| 25 | |
| 26 readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | 14 readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 27 readonly TEMP_DIR=$(mktemp -d) | 15 readonly TEMP_DIR=$(mktemp -d) |
| 28 readonly EXTERNS_DIR="${SCRIPT_DIR}/externs" | 16 readonly EXTERNS_DIR="${SCRIPT_DIR}/externs" |
| 29 readonly README="${SCRIPT_DIR}/README.chromium" | 17 readonly README="${SCRIPT_DIR}/README.chromium" |
| 30 | 18 |
| 31 cleanup() { | 19 cleanup() { |
| 32 rm -rf "${TEMP_DIR}" | 20 rm -rf "${TEMP_DIR}" |
| 33 } | 21 } |
| 34 | 22 |
| 35 get_sha1() { | 23 get_sha1() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 56 cleanup | 44 cleanup |
| 57 exit 0 | 45 exit 0 |
| 58 else | 46 else |
| 59 head_range=$(cat <<EOT | 47 head_range=$(cat <<EOT |
| 60 Change log: | 48 Change log: |
| 61 https://github.com/google/closure-compiler/compare/${old_head}...${new_head} | 49 https://github.com/google/closure-compiler/compare/${old_head}...${new_head} |
| 62 EOT | 50 EOT |
| 63 ) | 51 ) |
| 64 fi | 52 fi |
| 65 | 53 |
| 54 check_jdk_version() { | |
| 55 # Pretty contrived checks modeling how we write Maven XML files. | |
| 56 if ! test -r "$2"; then | |
|
Dan Beam
2017/04/04 17:30:34
the shell styleguide says something about not usin
| |
| 57 echo "Could not find $2" >&2 | |
| 58 exit 1 | |
| 59 elif ! fgrep -q '<jdk.version>'$1'</jdk.version>' "$2"; then | |
| 60 echo "JDK version $1 must be specified in $2" >&2 | |
| 61 exit 1 | |
| 62 elif ! fgrep -q '<source>${jdk.version}</source>' "$2"; then | |
| 63 echo "Java source must be specified to be \${jdk.version} in $2" >&2 | |
| 64 exit 1 | |
| 65 elif ! fgrep -q '<target>${jdk.version}</target>' "$2"; then | |
| 66 echo "Java target must be specified to be \${jdk.version} in $2" >&2 | |
| 67 exit 1 | |
| 68 fi | |
| 69 } | |
| 70 | |
| 71 echo "Checking JDK Version Used to Build" | |
| 72 check_jdk_version 1.7 pom.xml | |
| 73 | |
| 66 echo "Building Closure Compiler" | 74 echo "Building Closure Compiler" |
| 67 mvn clean install -DskipTests=true --projects com.google.javascript:closure-comp iler,com.google.javascript:closure-compiler-externs | 75 mvn clean install -DskipTests=true --projects com.google.javascript:closure-comp iler,com.google.javascript:closure-compiler-externs |
| 68 | 76 |
| 69 if [[ "$?" -ne 0 ]]; then | 77 if [[ "$?" -ne 0 ]]; then |
| 70 echo "Failed to build jar, copying nothing" >&2 | 78 echo "Failed to build jar, copying nothing" >&2 |
| 71 cleanup | 79 cleanup |
| 72 exit 1 | 80 exit 1 |
| 73 fi | 81 fi |
| 74 | 82 |
| 75 # TODO(dbeam): the Maven-built jar seems a little bigger than the ant version. | 83 # TODO(dbeam): the Maven-built jar seems a little bigger than the ant version. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 echo "${head_range}" | 143 echo "${head_range}" |
| 136 if [[ ! -z "${extensions_range}" ]]; then echo "${extensions_range}"; fi | 144 if [[ ! -z "${extensions_range}" ]]; then echo "${extensions_range}"; fi |
| 137 if [[ ! -z "${polymer_range}" ]]; then echo "${polymer_range}"; fi | 145 if [[ ! -z "${polymer_range}" ]]; then echo "${polymer_range}"; fi |
| 138 echo | 146 echo |
| 139 echo "TBR=" | 147 echo "TBR=" |
| 140 echo "BUG='" | 148 echo "BUG='" |
| 141 echo | 149 echo |
| 142 echo "git cl upload" | 150 echo "git cl upload" |
| 143 | 151 |
| 144 cleanup | 152 cleanup |
| OLD | NEW |