Commit 21826285 authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI: Stop compiling Closure compiler, just download it instead.

Historically the Closure compiler was compiled from scratch, because it was
modified to include a Chrome-specific pass. ChromePass.java has been upstreamed
to the canonical repo for a while now, so there is no need to keep building the
compiler from scratch anymore (as of r445661)

Benefits: Rolling a new Closure compiler version is now much
 - Faster (before it took a few minutes, now it takes a few seconds).
 - Easier (no more dependencies to mvn and jdk, no setup required)

Cons:
 - No automated changelog link between previous and new versions.
 - Can't pull in closure-compiler master branch anymore, instead only what's at
   https://dl.google.com/closure-compiler/compiler-latest.zip is available.

This CL also rolls a new Closure compiler version as a proof that the new
roll_closure_compiler script works.

Bug: 867683
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I19671593a32c379ce9c3fb919f889aab56d939cf
Reviewed-on: https://chromium-review.googlesource.com/1214746Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590377}
parent f2d2903e
Name: Closure compiler Name: Closure compiler
Short Name: closure-compiler Short Name: closure-compiler
URL: http://github.com/google/closure-compiler URL: http://github.com/google/closure-compiler
Version: v20180725-137c24759 Version: v20180805
Date: 2018/07/27 19:34 Date: 2018/09/08 01:00
Revision: 137c2475944651f45433965afa9f1cddf7d1966b
License: Apache 2.0 License: Apache 2.0
License File: LICENSE License File: LICENSE
Security Critical: no Security Critical: no
......
...@@ -6248,6 +6248,16 @@ chrome.system.display.GetInfoFlags; ...@@ -6248,6 +6248,16 @@ chrome.system.display.GetInfoFlags;
chrome.system.display.MirrorModeInfo; chrome.system.display.MirrorModeInfo;
/**
* @typedef {!{
* manufacturerId: string,
* productId: string,
* yearOfManufacture: number,
* }}
*/
chrome.system.display.Edid;
/** /**
* An undocumented type that defines the objects passed to getInfo()'s callback. * An undocumented type that defines the objects passed to getInfo()'s callback.
* @constructor * @constructor
...@@ -6263,6 +6273,10 @@ chrome.system.display.DisplayUnitInfo.prototype.id; ...@@ -6263,6 +6273,10 @@ chrome.system.display.DisplayUnitInfo.prototype.id;
chrome.system.display.DisplayUnitInfo.prototype.name; chrome.system.display.DisplayUnitInfo.prototype.name;
/** @type {!chrome.system.display.Edid|undefined} */
chrome.system.display.DisplayUnitInfo.prototype.edid;
/** @type {string} */ /** @type {string} */
chrome.system.display.DisplayUnitInfo.prototype.mirroringSourceId; chrome.system.display.DisplayUnitInfo.prototype.mirroringSourceId;
......
...@@ -1368,6 +1368,23 @@ DomRepeatElement.prototype.indexForElement = function(el) {}; ...@@ -1368,6 +1368,23 @@ DomRepeatElement.prototype.indexForElement = function(el) {};
DomRepeatElement.prototype.renderedItemCount; DomRepeatElement.prototype.renderedItemCount;
/**
* Event object for an event handler on a child of a dom-repeat template.
* @see https://www.polymer-project.org/1.0/docs/devguide/templates#handling-events
* @extends {CustomEvent}
* @constructor
* @template T
*/
var DomRepeatEvent = function() {};
/**
* @type {{
* index: number,
* item: T
* }}
*/
DomRepeatEvent.prototype.model;
/** /**
* @see https://github.com/Polymer/polymer/blob/master/src/lib/template/array-selector.html * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/array-selector.html
......
...@@ -3,16 +3,12 @@ ...@@ -3,16 +3,12 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
# #
# Download the newest version of Closure Compiler, build it and put into Chrome # Download the newest version of Closure Compiler (pre-compiled), and put into
# source tree. Also update externs/chrome_extensions.js. # Chrome source tree. Also download latest versions of various externs files.
#
# TODO(dbeam): we don't really need to build the compiler any more. We used to
# need to because we built a custom runner. We could probably just curl
# https://dl.google.com/closure-compiler/compiler-latest.zip and unzip. And get
# the externs from rawgit.com.
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly TEMP_DIR=$(mktemp -d) readonly TEMP_DIR=$(mktemp -d)
readonly EXTERNS_DIR_URL="https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs"
readonly EXTERNS_DIR="${SCRIPT_DIR}/externs" readonly EXTERNS_DIR="${SCRIPT_DIR}/externs"
readonly README="${SCRIPT_DIR}/README.chromium" readonly README="${SCRIPT_DIR}/README.chromium"
...@@ -26,65 +22,25 @@ get_sha1() { ...@@ -26,65 +22,25 @@ get_sha1() {
trap cleanup SIGINT SIGHUP SIGTERM trap cleanup SIGINT SIGHUP SIGTERM
old_head=$(egrep -o "^Revision: [0-9a-f]{5,40}$" "${README}" | cut -d" " -f2)
old_chrome_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome.js") old_chrome_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome.js")
old_extensions_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome_extensions.js") old_extensions_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome_extensions.js")
old_polymer_sha1=$(get_sha1 "${EXTERNS_DIR}/polymer-1.0.js") old_polymer_sha1=$(get_sha1 "${EXTERNS_DIR}/polymer-1.0.js")
cd "${TEMP_DIR}" cd "${TEMP_DIR}"
echo "Cloning Closure Compiler repo" echo "Downloading Closure Compiler latest..."
git clone --depth 1 https://github.com/google/closure-compiler.git wget https://dl.google.com/closure-compiler/compiler-latest.zip
unzip compiler-latest.zip
cd closure-compiler
new_head="$(git rev-parse HEAD)" jar_file=$(basename $(find . -name '*.jar'))
new_version="$(git log HEAD -n1 --date=format:%Y%m%d --pretty=format:v%cd-%h)" new_version=$(basename $(echo ${jar_file} | cut -f3 -d-) .jar)
new_date="$(date --utc '+%Y/%m/%d %H:%M')" new_date="$(date --utc '+%Y/%m/%d %H:%M')"
if [[ "${new_head}" == "${old_head}" ]]; then cp "${jar_file}" "${SCRIPT_DIR}/compiler/compiler.jar"
echo "No closure-compiler changes since last roll. Nothing to do."
cleanup
exit 0
else
head_range=$(cat <<EOT
Change log:
https://github.com/google/closure-compiler/compare/${old_head}...${new_head}
EOT
)
fi
check_jdk_version() {
# Pretty contrived checks modeling how we write Maven XML files.
if [ ! -r "$2" ]; then
echo "Could not find $2" >&2
exit 1
elif ! fgrep -q '<jdk.version>'$1'</jdk.version>' "$2"; then
echo "JDK version $1 must be specified in $2" >&2
exit 1
elif ! fgrep -q '<source>${jdk.version}</source>' "$2"; then
echo "Java source must be specified to be \${jdk.version} in $2" >&2
exit 1
elif ! fgrep -q '<target>${jdk.version}</target>' "$2"; then
echo "Java target must be specified to be \${jdk.version} in $2" >&2
exit 1
fi
}
echo "Checking JDK Version Used to Build" wget ${EXTERNS_DIR_URL}/chrome.js
check_jdk_version 1.8 pom.xml wget ${EXTERNS_DIR_URL}/chrome_extensions.js
wget ${EXTERNS_DIR_URL}/polymer-1.0.js
echo "Building Closure Compiler"
mvn clean install -DskipTests=true --projects com.google.javascript:closure-compiler,com.google.javascript:closure-compiler-externs
if [[ "$?" -ne 0 ]]; then
echo "Failed to build jar, copying nothing" >&2
cleanup
exit 1
fi
# TODO(dbeam): the Maven-built jar seems a little bigger than the ant version.
cp target/closure-compiler-1.0-SNAPSHOT.jar "${SCRIPT_DIR}/compiler/compiler.jar"
readonly WARNING="$(cat <<EOT readonly WARNING="$(cat <<EOT
// SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP // SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP
...@@ -106,9 +62,9 @@ readonly WARNING="$(cat <<EOT ...@@ -106,9 +62,9 @@ readonly WARNING="$(cat <<EOT
EOT EOT
)" )"
(echo "${WARNING}" && cat contrib/externs/chrome.js) > "${EXTERNS_DIR}/chrome.js" (echo "${WARNING}" && cat chrome.js) > "${EXTERNS_DIR}/chrome.js"
(echo "${WARNING}" && cat contrib/externs/chrome_extensions.js) > "${EXTERNS_DIR}/chrome_extensions.js" (echo "${WARNING}" && cat chrome_extensions.js) > "${EXTERNS_DIR}/chrome_extensions.js"
(echo "${WARNING}" && cat contrib/externs/polymer-1.0.js) > "${EXTERNS_DIR}/polymer-1.0.js" (echo "${WARNING}" && cat polymer-1.0.js) > "${EXTERNS_DIR}/polymer-1.0.js"
new_chrome_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome.js") new_chrome_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome.js")
if [[ "${new_chrome_sha1}" != "${old_chrome_sha1}" ]]; then if [[ "${new_chrome_sha1}" != "${old_chrome_sha1}" ]]; then
...@@ -130,9 +86,9 @@ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ...@@ -130,9 +86,9 @@ echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@" echo "@"
echo "@ ROLL RESULTS:" echo "@ ROLL RESULTS:"
echo "@" echo "@"
echo "@ closure-compiler.git HEAD:" echo "@ closure-compiler-latest.zip version:"
echo "@ Old: ${old_head}" echo "@ Old: ${old_version}"
echo "@ New: ${new_head}" echo "@ New: ${new_version}"
echo "@" echo "@"
echo "@ externs/chrome.js SHA1:" echo "@ externs/chrome.js SHA1:"
echo "@ Old: ${old_chrome_sha1}" echo "@ Old: ${old_chrome_sha1}"
...@@ -149,11 +105,11 @@ echo "@" ...@@ -149,11 +105,11 @@ echo "@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo echo
sed -i "s/^Revision: ${old_head}$/Revision: ${new_head}/; s,^Date: .*,Date: ${new_date},; s,^Version: .*,Version: ${new_version}," "${README}" sed -i "s,^Date: .*,Date: ${new_date},; s,^Version: .*,Version: ${new_version}," "${README}"
echo "git commit -a -m 'Roll closure compiler" echo "git commit -a -m 'Roll closure compiler"
echo echo
echo "${head_range}"
if [[ ! -z "${chrome_range}" ]]; then echo "${chrome_range}"; fi if [[ ! -z "${chrome_range}" ]]; then echo "${chrome_range}"; fi
if [[ ! -z "${extensions_range}" ]]; then echo "${extensions_range}"; fi if [[ ! -z "${extensions_range}" ]]; then echo "${extensions_range}"; fi
if [[ ! -z "${polymer_range}" ]]; then echo "${polymer_range}"; fi if [[ ! -z "${polymer_range}" ]]; then echo "${polymer_range}"; fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment