Skip to content

Commit

Permalink
Get Polymer externs from closure/github (instead of Polymer/bower)
Browse files Browse the repository at this point in the history
R=jlklein@chromium.org
TBR=fukino@chromium.org  # for trivial path change
BUG=none

Review-Url: https://codereview.chromium.org/2052973002
Cr-Commit-Position: refs/heads/master@{#398991}
  • Loading branch information
danbeam authored and Commit bot committed Jun 9, 2016
1 parent 2a4d1eb commit f513e71
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 59 deletions.
5 changes: 1 addition & 4 deletions third_party/closure_compiler/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,7 @@ def check_multiple(self, sources, out_file=None, externs=None,
externs = set(opts.externs or [])
sources = set(opts.sources)

polymer_externs = os.path.join(os.path.dirname(_CURRENT_DIR), 'polymer',
'v1_0', 'components-chromium',
'polymer-externs', 'polymer.externs.js')
externs.add(polymer_externs)
externs.add(os.path.join(_CURRENT_DIR, "externs", "polymer-1.0.js"))

checker = Checker(verbose=opts.verbose, strict=opts.strict)
if opts.single_file:
Expand Down
4 changes: 1 addition & 3 deletions third_party/closure_compiler/compile2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ class Checker(object):

_MAP_FILE_FORMAT = "%s.map"

_POLYMER_EXTERNS = os.path.join(_CURRENT_DIR, "..", "polymer",
"v1_0", "components-chromium",
"polymer-externs", "polymer.externs.js")
_POLYMER_EXTERNS = os.path.join(_CURRENT_DIR, "externs", "polymer-1.0.js")

def __init__(self, verbose=False):
"""
Expand Down
4 changes: 1 addition & 3 deletions third_party/closure_compiler/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
_CR_JS = os.path.join(_RESOURCES_DIR, "cr.js")
_CR_UI_JS = os.path.join(_RESOURCES_DIR, "cr", "ui.js")
_PROMISE_RESOLVER_JS = os.path.join(_RESOURCES_DIR, "promise_resolver.js")
_POLYMER_EXTERNS = os.path.join(_SRC_DIR, "third_party", "polymer", "v1_0",
"components-chromium", "polymer-externs",
"polymer.externs.js")
_POLYMER_EXTERNS = os.path.join(_SCRIPT_DIR, "externs", "polymer-1.0.js")
_CHROME_SEND_EXTERNS = os.path.join(_SRC_DIR, "third_party", "closure_compiler",
"externs", "chrome_send.js")
_CLOSURE_ARGS_GYPI = os.path.join(_SCRIPT_DIR, "closure_args.gypi")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
// 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 roll_closure_compiler. 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
/*
* Copyright 2016 The Closure Compiler Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @fileoverview Closure compiler externs for the Polymer library.
* Originally part of the Polymer Project. Original license below.
*
* @externs
* @license
Expand All @@ -19,6 +51,23 @@
var Polymer = function(descriptor) {};


/**
* Re-evaluates and applies custom CSS properties based on dynamic
* changes to this element's scope, such as adding or removing classes.
*
* For performance reasons, Polymer's custom CSS property shim relies
* on this explicit signal from the user to indicate when changes have
* been made that affect the values of custom properties.
*
* @param {Object=} properties Properties object which is mixed into
* the document root `customStyle` property. This argument provides a
* shortcut for setting `customStyle` and then calling `updateStyles`.
*
* @see http://polymer.github.io/polymer/
*/
Polymer.updateStyles = function(properties) {};


/** @constructor @extends {HTMLElement} */
var PolymerElement = function() {};

Expand Down Expand Up @@ -309,11 +358,21 @@ PolymerElement.prototype.getEffectiveChildren = function() {};
PolymerElement.prototype.getEffectiveTextContent = function() {};

/**
* Returns the first effective child that match selector.
*
* @param {string} selector
* @return {?HTMLElement}
*/
PolymerElement.prototype.queryEffectiveChildren = function(selector) {};

/**
* Returns a list of effective children that match selector.
*
* @param {string} selector
* @return {!Array<!HTMLElement>}
*/
PolymerElement.prototype.queryAllEffectiveChildren = function(selector) {};

/**
* Fire an event.
*
Expand Down Expand Up @@ -438,6 +497,17 @@ Polymer.Base;
*/
Polymer.Base.async = function(method, wait) {};

/**
* Copies own properties (including accessor descriptors) from a source
* object to a target object.
*
* @param {?Object} target Target object to copy properties to.
* @param {?Object} source Source object to copy properties from.
* @return {?Object} Target object that was passed as first argument or source
* object if the target was null.
*/
Polymer.Base.extend = function(target, source) {};

/**
* Returns a property descriptor object for the property specified.
*
Expand All @@ -450,6 +520,19 @@ Polymer.Base.async = function(method, wait) {};
*/
Polymer.Base.getPropertyInfo = function(property) {};

/**
* Copies props from a source object to a target object.
*
* Note, this method uses a simple `for...in` strategy for enumerating
* properties. To ensure only `ownProperties` are copied from source
* to target and that accessor implementations are copied, use `extend`.
*
* @param {!Object} target Target object to copy properties to.
* @param {?Object} source Source object to copy properties from.
* @return {!Object} Target object that was passed as first argument.
*/
Polymer.Base.mixin = function(target, source) {};

Polymer.Gestures;

/**
Expand Down Expand Up @@ -577,23 +660,23 @@ PolymerElement.prototype.getComputedStyleValue = function(property) {};
/**
* Logs a message to the console.
*
* @param {!Array} var_args
* @param {...*} var_args
* @protected
*/
PolymerElement.prototype._log = function(var_args) {};

/**
* Logs a message to the console with a 'warn' level.
*
* @param {!Array} var_args
* @param {...*} var_args
* @protected
*/
PolymerElement.prototype._warn = function(var_args) {};

/**
* Logs a message to the console with an 'error' level.
*
* @param {!Array} var_args
* @param {...*} var_args
* @protected
*/
PolymerElement.prototype._error = function(var_args) {};
Expand All @@ -607,6 +690,33 @@ PolymerElement.prototype._error = function(var_args) {};
*/
PolymerElement.prototype._logf = function(var_args) {};

/** @type {boolean} True after this.ready() has run */
PolymerElement.prototype._readied;

/**
* Do not call this function.
*
* @param {string} path .
* @param {*} value .
*/
PolymerElement.prototype._notifyPathUp = function(path, value) {};

/**
* Do not call this function.
*
* @param {string} path .
* @param {*} value .
*/
PolymerElement.prototype._pathEffector = function(path, value) {};

/**
* Do not call this function.
*
* @param {string} path .
* @param {*} value .
*/
PolymerElement.prototype._propertySetter = function(path, value) {};


/**
* A Polymer DOM API for manipulating DOM such that local DOM and light DOM
Expand Down Expand Up @@ -773,6 +883,9 @@ PolymerEventApi.prototype.localTarget;
/** @type {?Array<!Element>|undefined} */
PolymerEventApi.prototype.path;

/** @type {Event} */
PolymerEventApi.prototype.event;


Polymer.Async;

Expand Down Expand Up @@ -1145,6 +1258,19 @@ var PolymerKeySplice;
*/
var PolymerSpliceChange;

/**
* The type of the object received by an observer function when deep
* sub-property observation is enabled. See:
* https://www.polymer-project.org/1.0/docs/devguide/properties.html#deep-observation
*
* @typedef {{
* path: string,
* value: (?Object|undefined),
* base: (?Object|undefined)
* }}
*/
var PolymerDeepPropertyChange;

/**
* The interface that iconsets should obey. Iconsets are registered by setting
* their name in the IronMeta 'iconset' db, and a value of type Polymer.Iconset.
Expand Down Expand Up @@ -1207,34 +1333,3 @@ Polymer.RenderStatus.whenReady = function(cb) {}
* @param {...*} args The function arguments.
*/
Polymer.RenderStatus.afterNextRender = function(element, fn, args) {}

Polymer.AppLayout;

/** @constructor */
Polymer.AppLayout.LocalDomWithBackground = function(){};
/** @type {!HTMLElement} */
Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundFrontLayer;
/** @type {!HTMLElement} */
Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundRearLayer;
/** @type {!HTMLElement} */
Polymer.AppLayout.LocalDomWithBackground.prototype.background;

/**
* @constructor
* @extends {PolymerElement}
*/
Polymer.AppLayout.ElementWithBackground = function(){};

// TODO(garlicnation): Follow up with app-layout team and remove private api from this prototype
Polymer.AppLayout.ElementWithBackground.prototype = {
/** @type {!Polymer.AppLayout.LocalDomWithBackground} */
$: null,
/** @return {boolean} True if there's content below the current element */
isContentBelow: function(){},
/** Updates the elements scroll state */
_updateScrollState: function(){},
/** @return {boolean} true if the element is on screen */
isOnScreen: function(){},
/** @type {number} Internal bookkeeping to track screen position */
_deltaHeight: 0,
}
40 changes: 27 additions & 13 deletions third_party/closure_compiler/roll_closure_compiler
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,23 @@ readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly TEMP_DIR=$(mktemp -d)

readonly COMPILER_PATH="${SCRIPT_DIR}/compiler/compiler.jar"
readonly EXTERNS_PATH="${SCRIPT_DIR}/externs/chrome_extensions.js"
readonly EXTERNS_DIR="${SCRIPT_DIR}/externs"

readonly README="${SCRIPT_DIR}/README.chromium"

cleanup() {
rm -rf "${TEMP_DIR}"
}

get_externs_sha1() {
sha1sum "${EXTERNS_PATH}" | cut -d' ' -f1
get_sha1() {
sha1sum "$1" | cut -d" " -f1
}

trap cleanup SIGINT SIGHUP SIGTERM

old_head=$(egrep -o '^Revision: [0-9a-f]{5,40}$' "${README}" | cut -d' ' -f2)
old_externs_sha1=$(get_externs_sha1)
old_head=$(egrep -o "^Revision: [0-9a-f]{5,40}$" "${README}" | cut -d" " -f2)
old_extensions_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome_extensions.js")
old_polymer_sha1=$(get_sha1 "${EXTERNS_DIR}/polymer-1.0.js")

cd "${TEMP_DIR}"

Expand Down Expand Up @@ -67,7 +68,7 @@ if [[ "$?" -ne 0 ]]; then
exit 1
fi

(cat <<EOT && cat contrib/externs/chrome_extensions.js) > "${EXTERNS_PATH}"
readonly WARNING="$(cat <<EOT
// SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP
// SS:::::::::::::::ST:::::::::::::::::::::T OO:::::::::OO P::::::::::::::::P
// S:::::SSSSSS::::::ST:::::::::::::::::::::T OO:::::::::::::OO P::::::PPPPPP:::::P
Expand All @@ -85,11 +86,19 @@ fi
// S:::::::::::::::SS T:::::::::T OO:::::::::OO P::::::::P
// SSSSSSSSSSSSSSS TTTTTTTTTTT OOOOOOOOO PPPPPPPPPP
EOT
)"

new_externs_sha1=$(get_externs_sha1)
(echo "${WARNING}" && cat contrib/externs/chrome_extensions.js) > "${EXTERNS_DIR}/chrome_extensions.js"
(echo "${WARNING}" && cat contrib/externs/polymer-1.0.js) > "${EXTERNS_DIR}/polymer-1.0.js"

if [[ "${new_externs_sha1}" != "${old_externs_sha1}" ]]; then
externs_range="chrome_extensions.js: ${old_externs_sha1} -> ${new_externs_sha1}"
new_extensions_sha1=$(get_sha1 "${EXTERNS_DIR}/chrome_extensions.js")
if [[ "${new_extensions_sha1}" != "${old_extensions_sha1}" ]]; then
extensions_range="chrome_extensions.js: ${old_extensions_sha1} -> ${new_extensions_sha1}"
fi

new_polymer_sha1=$(get_sha1 "${EXTERNS_DIR}/polymer-1.0.js")
if [[ "${new_polymer_sha1}" != "${old_polymer_sha1}" ]]; then
polymer_range="polymer-1.0.js: ${old_polymer_sha1} -> ${new_polymer_sha1}"
fi

echo
Expand All @@ -101,9 +110,13 @@ echo "@ closure-compiler.git HEAD:"
echo "@ Old: ${old_head}"
echo "@ New: ${new_head}"
echo "@"
echo "@ Externs SHA1:"
echo "@ Old: ${old_externs_sha1}"
echo "@ New: ${new_externs_sha1}"
echo "@ externs/chrome_extensions.js SHA1:"
echo "@ Old: ${old_extensions_sha1}"
echo "@ New: ${new_extensions_sha1}"
echo "@"
echo "@ externs/polymer-1.0.js SHA1:"
echo "@ Old: ${old_polymer_sha1}"
echo "@ New: ${new_polymer_sha1}"
echo "@"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo
Expand All @@ -113,7 +126,8 @@ sed -i "s/^Revision: ${old_head}$/Revision: ${new_head}/" "${README}"
echo "git commit -a -m 'Roll closure compiler"
echo
echo "${head_range}"
if [[ ! -z "${externs_range}" ]]; then echo "${externs_range}"; fi
if [[ ! -z "${extensions_range}" ]]; then echo "${extensions_range}"; fi
if [[ ! -z "${polymer_range}" ]]; then echo "${polymer_range}"; fi
echo
echo "TBR="
echo "BUG='"
Expand Down
1 change: 0 additions & 1 deletion third_party/polymer/v1_0/bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"paper-toggle-button": "PolymerElements/paper-toggle-button#^1.0.0",
"paper-toolbar": "PolymerElements/paper-toolbar#^1.0.0",
"paper-tooltip": "PolymerElements/paper-tooltip#^1.0.0",
"polymer-externs": "PolymerLabs/polymer-externs#^1.0.0",
"polymer": "Polymer/polymer#^v1.0.0",
"web-animations-js": "web-animations/web-animations-js#^2.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion ui/file_manager/gallery/js/compiled_resources.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
'<(EXTERNS_DIR)/file_manager_private.js',
'<(EXTERNS_DIR)/metrics_private.js',
'../../../../third_party/analytics/externs.js',
'../../../../third_party/polymer/v1_0/components-chromium/polymer-externs/polymer.externs.js',
'../../../../third_party/closure_compiler/externs/polymer-1.0.js',
'../../externs/chrome_test.js',
'../../externs/es6_workaround.js',
'../../externs/exif_entry.js',
Expand Down

0 comments on commit f513e71

Please sign in to comment.