Switch from Polymer 1 to Polymer 2

Bug: Issue 4699
Change-Id: Ie6ba626a79eeef05798c23228ce7cff94a45e0a0
This commit is contained in:
Tao Zhou
2019-10-15 13:52:17 +02:00
parent 34c43e775f
commit 84f0797804
19 changed files with 216 additions and 204 deletions

View File

@@ -3,7 +3,6 @@
Apache2.0
* fonts:robotofonts
* js:web-animations-js
* polymer_externs:polymer_closure
[[Apache2_0_license]]
@@ -477,33 +476,33 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----
[[promise-polyfill]]
promise-polyfill
[[shadycss]]
shadycss
* js:promise-polyfill
* js:shadycss
[[promise-polyfill_license]]
[[shadycss_license]]
----
Copyright (c) 2014 Taylor Hakes
Copyright (c) 2014 Forbes Lindesay
# License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Everything in this repo is BSD style license unless otherwise specified.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
Copyright (c) 2015 The Polymer Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
----

View File

@@ -74,7 +74,6 @@ Apache2.0
* jetty:servlet
* jetty:util
* jgit/org.eclipse.jgit:javaewah
* js:web-animations-js
* log:json-smart
* log:jsonevent-layout
* log:log4j
@@ -3340,37 +3339,6 @@ party waives its rights to a jury trial in any resulting litigation.
----
[[promise-polyfill]]
promise-polyfill
* js:promise-polyfill
[[promise-polyfill_license]]
----
Copyright (c) 2014 Taylor Hakes
Copyright (c) 2014 Forbes Lindesay
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
----
[[protobuf]]
protobuf
@@ -3415,6 +3383,37 @@ support library is itself covered by the above license.
----
[[shadycss]]
shadycss
* js:shadycss
[[shadycss_license]]
----
# License
Everything in this repo is BSD style license unless otherwise specified.
Copyright (c) 2015 The Polymer Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----
[[slf4j]]
slf4j

View File

@@ -1138,8 +1138,8 @@ npm_binary(
bower_archive(
name = "iron-autogrow-textarea",
package = "polymerelements/iron-autogrow-textarea",
sha1 = "68f0ece9b1e56ac26f8ce31d9938c504f6951bca",
version = "2.1.0",
sha1 = "2f04c7e2a72d462de36093ab2b4889db20f699f6",
version = "2.2.0",
)
bower_archive(
@@ -1159,64 +1159,64 @@ bower_archive(
bower_archive(
name = "iron-dropdown",
package = "polymerelements/iron-dropdown",
sha1 = "ac96fe31cdf203a63426fa75131b43c98c0597d3",
version = "1.5.5",
sha1 = "3902ba164552b1bfc59e6fa692efa4a1fd8dd4ea",
version = "2.2.1",
)
bower_archive(
name = "iron-input",
package = "polymerelements/iron-input",
sha1 = "9bc0c8e81de2527125383cbcf74dd9f27e7fa9ac",
version = "1.0.10",
sha1 = "f79952ff4f6f103c0a2cbd3dacf25935257ff392",
version = "2.1.3",
)
bower_archive(
name = "iron-overlay-behavior",
package = "polymerelements/iron-overlay-behavior",
sha1 = "74cda9d7bf98e7a5e5004bc7ebdb6d208d49e11e",
version = "2.0.0",
sha1 = "c2d2eac1b162420d9475ade2f16d5db8959b93fc",
version = "2.3.4",
)
bower_archive(
name = "iron-selector",
package = "polymerelements/iron-selector",
sha1 = "e0ee46c28523bf17730318c3b481a8ed4331c3b2",
version = "2.0.0",
sha1 = "3f3fcb55f6bd606ea493f99eab9daae21f7a6139",
version = "2.1.0",
)
bower_archive(
name = "paper-button",
package = "polymerelements/paper-button",
sha1 = "3b01774f58a8085d3c903fc5a32944b26ab7be72",
version = "2.0.0",
sha1 = "bcb783d74e1177c1d0836340e7c0280699d1438c",
version = "2.1.3",
)
bower_archive(
name = "paper-input",
package = "polymerelements/paper-input",
sha1 = "6c934805e80ab201e143406edc73ea0ef35abf80",
version = "1.1.18",
sha1 = "c1a81a4173d22e72e8ab609eb3715a75273396b3",
version = "2.2.3",
)
bower_archive(
name = "paper-tabs",
package = "polymerelements/paper-tabs",
sha1 = "b6dd2fbd7ee887534334057a29eb545b940fc5cf",
version = "2.0.0",
sha1 = "589b8e6efa0f171c93233137c8ea013dcea0ffc7",
version = "2.1.1",
)
bower_archive(
name = "iron-icon",
package = "polymerelements/iron-icon",
sha1 = "7da49a0d33cd56017740e0dbcf41d2b71532023f",
version = "2.0.0",
sha1 = "d21e7d4f1bdc6de881390f888e28d53155eeb551",
version = "2.1.0",
)
bower_archive(
name = "iron-iconset-svg",
package = "polymerelements/iron-iconset-svg",
sha1 = "4d0c406239cad2ff2975c6dd95fa189de0fe6b50",
version = "2.1.0",
sha1 = "07c0ce02ce6479856758893416a3709009db7f22",
version = "2.2.1",
)
bower_archive(
@@ -1236,29 +1236,29 @@ bower_archive(
bower_archive(
name = "paper-item",
package = "polymerelements/paper-item",
sha1 = "803273ceb9ffebec8ecc9373ea638af4cd34af58",
version = "1.1.4",
sha1 = "c3bad022cf182d2bf1c8a44374c7fcb1409afbfa",
version = "2.1.1",
)
bower_archive(
name = "paper-listbox",
package = "polymerelements/paper-listbox",
sha1 = "ccc1a90ab0a96878c7bf7c9c4cfe47c85b09c8e3",
version = "2.0.0",
sha1 = "78247cc32bb776f204efef17cff3095878036a40",
version = "2.1.1",
)
bower_archive(
name = "paper-toggle-button",
package = "polymerelements/paper-toggle-button",
sha1 = "4a2edbdb52c4531d39fe091f12de650bccda270f",
version = "1.2.0",
sha1 = "9927960afb0062726ec1b585ef3e32764c3bbac9",
version = "2.1.1",
)
bower_archive(
name = "polymer",
package = "polymer/polymer",
sha1 = "158443ab05ade5e2cdc24ebc01f1deef9aebac1b",
version = "1.11.3",
sha1 = "d06e17a1d8dc6187ee5aa8c5b3501da10901c82f",
version = "2.7.2",
)
bower_archive(
@@ -1268,13 +1268,6 @@ bower_archive(
version = "2.0.1",
)
bower_archive(
name = "promise-polyfill",
package = "polymerlabs/promise-polyfill",
sha1 = "a3b598c06cbd7f441402e666ff748326030905d6",
version = "1.0.0",
)
bower_archive(
name = "resemblejs",
package = "rsmbl/Resemble.js",
@@ -1294,15 +1287,15 @@ bower_archive(
bower_archive(
name = "iron-test-helpers",
package = "polymerelements/iron-test-helpers",
sha1 = "433b03b106f5ff32049b84150cd70938e18b67ac",
version = "1.2.5",
sha1 = "882be2d4c8714b39299b5f7bf25253c4e8a40761",
version = "2.0.1",
)
bower_archive(
name = "test-fixture",
package = "polymerelements/test-fixture",
sha1 = "e373bd21c069163c3a754e234d52c07c77b20d3c",
version = "1.1.1",
sha1 = "7d72ddfebf555a2dd1fc60a85427d9026b509723",
version = "3.0.0",
)
bower_archive(

View File

@@ -111,6 +111,10 @@ public class IndexHtmlUtil {
SanitizedContent sanitizedStaticPath = urlInScriptTagOrdainer.apply(staticPath);
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
// TODO(taoalpha): Remove once p2 fully rolled out
data.put("polymer2", "true");
if (canonicalPath != null) {
data.put("canonicalPath", canonicalPath);
}
@@ -120,9 +124,6 @@ public class IndexHtmlUtil {
if (faviconPath != null) {
data.put("faviconPath", faviconPath);
}
if (urlParameterMap.containsKey("p2")) {
data.put("polymer2", "true");
}
if (urlParameterMap.containsKey("ce")) {
data.put("polyfillCE", "true");
}

View File

@@ -17,31 +17,19 @@ package com.google.gerrit.httpd.raw;
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.httpd.raw.IndexHtmlUtil.staticTemplateData;
import com.google.common.collect.ImmutableMap;
import com.google.template.soy.data.SanitizedContent;
import com.google.template.soy.data.UnsafeSanitizedContentOrdainer;
import java.util.HashMap;
import org.junit.Test;
public class IndexHtmlUtilTest {
@Test
public void polymer2() throws Exception {
assertThat(
staticTemplateData(
"http://example.com/",
null,
null,
ImmutableMap.of("p2", new String[0]),
IndexHtmlUtilTest::ordain))
.containsExactly("canonicalPath", "", "polymer2", "true", "staticResourcePath", ordain(""));
}
@Test
public void noPathAndNoCDN() throws Exception {
assertThat(
staticTemplateData(
"http://example.com/", null, null, new HashMap<>(), IndexHtmlUtilTest::ordain))
.containsExactly("canonicalPath", "", "staticResourcePath", ordain(""));
.containsExactly("canonicalPath", "", "polymer2", "true", "staticResourcePath", ordain(""));
}
@Test
@@ -53,7 +41,13 @@ public class IndexHtmlUtilTest {
null,
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly("canonicalPath", "/gerrit", "staticResourcePath", ordain("/gerrit"));
.containsExactly(
"canonicalPath",
"/gerrit",
"polymer2",
"true",
"staticResourcePath",
ordain("/gerrit"));
}
@Test
@@ -66,7 +60,12 @@ public class IndexHtmlUtilTest {
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly(
"canonicalPath", "", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
"canonicalPath",
"",
"polymer2",
"true",
"staticResourcePath",
ordain("http://my-cdn.com/foo/bar/"));
}
@Test
@@ -79,7 +78,12 @@ public class IndexHtmlUtilTest {
new HashMap<>(),
IndexHtmlUtilTest::ordain))
.containsExactly(
"canonicalPath", "/gerrit", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
"canonicalPath",
"/gerrit",
"polymer2",
"true",
"staticResourcePath",
ordain("http://my-cdn.com/foo/bar/"));
}
private static SanitizedContent ordain(String s) {

20
lib/LICENSE-shadycss Normal file
View File

@@ -0,0 +1,20 @@
# License
Everything in this repo is BSD style license unless otherwise specified.
Copyright (c) 2015 The Polymer Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -34,44 +34,44 @@ def load_bower_archives():
bower_archive(
name = "iron-a11y-announcer",
package = "PolymerElements/iron-a11y-announcer",
version = "1.0.6",
sha1 = "14aed1e1b300ea344e80362e875919ea3d104dcc",
version = "2.1.0",
sha1 = "bda12ed6fe7b98a64bf5f70f3e84384053763190",
)
bower_archive(
name = "iron-a11y-keys-behavior",
package = "PolymerElements/iron-a11y-keys-behavior",
version = "1.1.9",
sha1 = "f58358ee652c67e6e721364ba50fb77a2ece1465",
version = "2.1.1",
sha1 = "4c8f303479253301e81c63b8ba7bd4cfb62ddf55",
)
bower_archive(
name = "iron-behaviors",
package = "PolymerElements/iron-behaviors",
version = "1.0.18",
sha1 = "e231a1a02b090f5183db917639fdb96cdd0dca18",
version = "2.1.1",
sha1 = "d2418e886c3237dcbc8d74a956eec367a95cd068",
)
bower_archive(
name = "iron-checked-element-behavior",
package = "PolymerElements/iron-checked-element-behavior",
version = "1.0.6",
sha1 = "93ad3554cec119d8c5732d1c722ad113e1866370",
version = "2.1.1",
sha1 = "822b6c73e349cf5174e3a17aa9b3d2cb823c37ac",
)
bower_archive(
name = "iron-fit-behavior",
package = "PolymerElements/iron-fit-behavior",
version = "1.2.7",
sha1 = "01c485fbf898307029bbb72ac7e132db1570a842",
version = "2.2.1",
sha1 = "7b12bc96bf05f04bbb6ad78a16d6c39758263a14",
)
bower_archive(
name = "iron-flex-layout",
package = "PolymerElements/iron-flex-layout",
version = "1.3.9",
sha1 = "d987b924cf29fcfe4b393833e81fdc9f1e268796",
version = "2.0.3",
sha1 = "c88e9577cabb005ea6d33f35b97d9c39c68f3d9e",
)
bower_archive(
name = "iron-form-element-behavior",
package = "PolymerElements/iron-form-element-behavior",
version = "1.0.7",
sha1 = "7b5a79e02cc32f0918725dd26925d0df1e03ed12",
version = "2.1.3",
sha1 = "634f01cdedd7a616ae025fdcde85c6c5804f6377",
)
bower_archive(
name = "iron-menu-behavior",
@@ -82,20 +82,20 @@ def load_bower_archives():
bower_archive(
name = "iron-meta",
package = "PolymerElements/iron-meta",
version = "1.1.3",
sha1 = "f77eba3f6f6817f10bda33918bde8f963d450041",
version = "2.1.1",
sha1 = "7985a9f18b6c32d62f5d3870d58d73ef66613cb9",
)
bower_archive(
name = "iron-resizable-behavior",
package = "polymerelements/iron-resizable-behavior",
version = "1.0.6",
sha1 = "719c2a8a1a784f8aefcdeef41fcc2e5a03518d9e",
package = "PolymerElements/iron-resizable-behavior",
version = "2.1.1",
sha1 = "31e32da6880a983da32da21ee3f483525b24e458",
)
bower_archive(
name = "iron-validatable-behavior",
package = "PolymerElements/iron-validatable-behavior",
version = "1.1.2",
sha1 = "7111f34ff32e1510131dfbdb1eaa51bfa291e8be",
version = "2.1.0",
sha1 = "b5dcf3bf4d95b074b74f8170d7122d34ab417daf",
)
bower_archive(
name = "lodash",
@@ -111,15 +111,15 @@ def load_bower_archives():
)
bower_archive(
name = "neon-animation",
package = "polymerelements/neon-animation",
version = "1.2.5",
sha1 = "588d289f779d02b21ce5b676e257bbd6155649e8",
package = "PolymerElements/neon-animation",
version = "2.2.1",
sha1 = "865f4252c6306b91609769fefefb4f641361931f",
)
bower_archive(
name = "paper-behaviors",
package = "PolymerElements/paper-behaviors",
version = "1.0.13",
sha1 = "a81eab28a952e124c208430e17508d9a1aae4ee7",
version = "2.1.1",
sha1 = "af59936a9015cda4abcfb235f831090a41faa2c4",
)
bower_archive(
name = "paper-icon-button",
@@ -130,14 +130,20 @@ def load_bower_archives():
bower_archive(
name = "paper-ripple",
package = "PolymerElements/paper-ripple",
version = "1.0.10",
sha1 = "21199db50d02b842da54bd6f4f1d1b10b474e893",
version = "2.1.1",
sha1 = "d402c8165c6a09d17c12a2b421e69ea54e2fc8ef",
)
bower_archive(
name = "paper-styles",
package = "PolymerElements/paper-styles",
version = "1.3.1",
sha1 = "4ee9c692366949a754e0e39f8031aa60ce66f24d",
version = "2.1.0",
sha1 = "c143c5491571a6922c06ffe7fdf64ec009ec2eb1",
)
bower_archive(
name = "shadycss",
package = "webcomponents/shadycss",
version = "1.9.1",
sha1 = "3ef3bd54280ea2d7ce90434620354a2022c8e13d",
)
bower_archive(
name = "sinon-chai",
@@ -157,15 +163,9 @@ def load_bower_archives():
version = "1.3.2",
sha1 = "d6c07a0112ab2e9677fe085933744466a89232fb",
)
bower_archive(
name = "web-animations-js",
package = "web-animations/web-animations-js",
version = "2.3.1",
sha1 = "2ba5548d36188fe54555eaad0a576de4b027661e",
)
bower_archive(
name = "webcomponentsjs",
package = "webcomponents/webcomponentsjs",
version = "0.7.24",
sha1 = "559227f8ee9db9bfbd81989f24510cc0c1bfc65c",
version = "1.3.3",
sha1 = "bbad90bd8301a2f2f5e014e750e0c86351579391",
)

View File

@@ -77,7 +77,6 @@ def define_bower_components():
deps = [
":iron-behaviors",
":iron-overlay-behavior",
":iron-resizable-behavior",
":neon-animation",
":polymer",
],
@@ -195,11 +194,9 @@ def define_bower_components():
name = "neon-animation",
license = "//lib:LICENSE-polymer",
deps = [
":iron-meta",
":iron-resizable-behavior",
":iron-selector",
":polymer",
":web-animations-js",
],
)
bower_component(
@@ -331,14 +328,15 @@ def define_bower_components():
bower_component(
name = "polymer",
license = "//lib:LICENSE-polymer",
deps = [":webcomponentsjs"],
deps = [
":shadycss",
":webcomponentsjs",
],
seed = True,
)
bower_component(
name = "promise-polyfill",
license = "//lib:LICENSE-promise-polyfill",
deps = [":polymer"],
seed = True,
name = "shadycss",
license = "//lib:LICENSE-shadycss",
)
bower_component(
name = "sinon-chai",
@@ -357,10 +355,6 @@ def define_bower_components():
license = "//lib:LICENSE-DO_NOT_DISTRIBUTE",
seed = True,
)
bower_component(
name = "web-animations-js",
license = "//lib:LICENSE-Apache2.0",
)
bower_component(
name = "web-component-tester",
license = "//lib:LICENSE-DO_NOT_DISTRIBUTE",

View File

@@ -31,7 +31,7 @@ bower_component_bundle(
"//lib/js:paper-toggle-button",
"//lib/js:polymer",
"//lib/js:polymer-resin",
"//lib/js:promise-polyfill",
"//lib/js:shadycss",
],
)

View File

@@ -14,6 +14,11 @@ 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.
-->
<!--
TODO(taoalpha): This file only used by google,
remove once polymer 2 fully rolled out.
-->
<script>
window.Gerrit = window.Gerrit || {};

View File

@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// TODO(taoalpha): This file is only used by google,
// remove once polymer fully rolled out.
(function() {
'use strict';

View File

@@ -15,18 +15,21 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<script>
// This must be set prior to loading Polymer for the first time.
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
window.Polymer = {
dom: 'shadow',
passiveTouchGestures: true,
lazyRegister: true,
};
} else if (!window.Polymer) {
window.Polymer = {
passiveTouchGestures: true,
lazyRegister: true,
};
// TODO(taoalpha): clean up after p2 fully rolled out
if (!window.POLYMER2) {
// This must be set prior to loading Polymer for the first time.
if (localStorage.getItem('USE_SHADOW_DOM') === 'true') {
window.Polymer = {
dom: 'shadow',
passiveTouchGestures: true,
lazyRegister: true,
};
} else if (!window.Polymer) {
window.Polymer = {
passiveTouchGestures: true,
lazyRegister: true,
};
}
}
window.Gerrit = window.Gerrit || {};
@@ -36,6 +39,8 @@ limitations under the License.
<link rel="import" href="/bower_components/polymer/polymer.html">
<link rel="import" href="/bower_components/polymer-resin/standalone/polymer-resin.html">
<!-- TODO(taoalpha): Remove once all legacyUndefinedCheck removed. -->
<link rel="import" href="/bower_components/polymer/lib/legacy/legacy-data-mixin.html">
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
<script>
security.polymer_resin.install({

View File

@@ -21,7 +21,10 @@
// requestAnimationFrame.)
// @see https://github.com/Polymer/polymer/issues/3851
// @see Issue 4699
Polymer.RenderStatus._makeReady();
// TODO(taoalpha): Remove once p2 fully rolled out
if (!window.POLYMER2) {
Polymer.RenderStatus._makeReady();
}
Polymer({
is: 'gr-app',

View File

@@ -28,7 +28,7 @@ limitations under the License.
<script>
const link = document.createElement('link');
link.setAttribute('rel', 'import');
link.setAttribute('href', window.POLYMER2 ? 'gr-app-p2.html' : 'gr-app.html');
link.setAttribute('href', 'gr-app.html');
document.head.appendChild(link);
</script>
@@ -40,12 +40,6 @@ limitations under the License.
</template>
</test-fixture>
<test-fixture id="basic-p2">
<template>
<gr-app-p2 id="app"></gr-app-p2>
</template>
</test-fixture>
<script>
suite('gr-app tests', () => {
let sandbox;
@@ -80,7 +74,7 @@ limitations under the License.
probePath() { return Promise.resolve(42); },
});
element = fixture(window.POLYMER2 ? 'basic-p2' : 'basic');
element = fixture('basic');
flush(done);
});

View File

@@ -14,11 +14,10 @@ def polygerrit_bundle(name, srcs, outs, app):
# See: https://github.com/google/closure-compiler/issues/2042
compilation_level = "WHITESPACE_ONLY",
defs = [
"--polymer_version=1",
"--polymer_version=2",
"--jscomp_off=duplicate",
"--force_inject_library=es6_runtime",
],
language = "ECMASCRIPT5",
language = "ECMASCRIPT_2017",
deps = [name + "_closure_lib"],
)

View File

@@ -20,6 +20,7 @@ limitations under the License.
href="/bower_components/polymer-resin/standalone/polymer-resin.html" />
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
<script>
window.POLYMER2 = true;
security.polymer_resin.install({
allowedIdentifierPrefixes: [''],
reportHandler(isViolation, fmt, ...args) {
@@ -61,5 +62,6 @@ limitations under the License.
</script>
<link rel="import"
href="/bower_components/iron-test-helpers/iron-test-helpers.html" />
<link rel="import" href="/bower_components/polymer/lib/legacy/legacy-data-mixin.html">
<link rel="import" href="test-router.html" />
<script src="/bower_components/moment/moment.js"></script>

View File

@@ -15,6 +15,8 @@
* limitations under the License.
*/
window.POLYMER2 = true;
/**
* Helps looking up the proper iron-input element during the Polymer 2
* transition. Polymer 2 uses the <iron-input> element, while Polymer 1 uses

View File

@@ -41,11 +41,12 @@
<script>
window.CLOSURE_NO_DEPS = true;
// TODO(taoalpha): clean up once p2 fully rolled out
{if $polymer2}window.POLYMER2 = true;{/if}
{if $canonicalPath != ''}window.CANONICAL_PATH = '{$canonicalPath}';{/if}
{if $versionInfo}window.VERSION_INFO = '{$versionInfo}';{/if}
{if $staticResourcePath != ''}window.STATIC_RESOURCE_PATH = '{$staticResourcePath}';{/if}
{if $assetsPath}window.ASSETS_PATH = '{$assetsPath}';{/if}
{if $polymer2}window.POLYMER2 = true;{/if}
{if $polyfillCE}if (window.customElements) window.customElements.forcePolyfill = true;{/if}
{if $polyfillSD}{literal}ShadyDOM = { force: true };{/literal}{/if}
{if $polyfillSC}{literal}ShadyCSS = { shimcssproperties: true};{/literal}{/if}
@@ -79,11 +80,7 @@
<link rel="stylesheet" href="{$staticResourcePath}/styles/fonts.css">{\n}
<link rel="stylesheet" href="{$staticResourcePath}/styles/main.css">{\n}
{if $polymer2}
<script src="{$staticResourcePath}/bower_components/webcomponentsjs-p2/webcomponents-lite.js"></script>{\n}
{else}
<script src="{$staticResourcePath}/bower_components/webcomponentsjs/webcomponents-lite.js"></script>{\n}
{/if}
<script src="{$staticResourcePath}/bower_components/webcomponentsjs/webcomponents-lite.js"></script>{\n}
// Content between webcomponents-lite and the load of the main app element
// run before polymer-resin is installed so may have security consequences.
@@ -95,16 +92,8 @@
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
{/if}
{if $polymer2}
<link rel="import" href="{$staticResourcePath}/elements/gr-app-p2.html">{\n}
{else}
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
{/if}
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
<body unresolved>{\n}
{if $polymer2}
<gr-app-p2 id="app"></gr-app-p2>{\n}
{else}
<gr-app id="app"></gr-app>{\n}
{/if}
{/template}

View File

@@ -486,8 +486,8 @@ def polygerrit_plugin(name, app, srcs = [], deps = [], externs = [], assets = No
name = name + "_bin",
compilation_level = "WHITESPACE_ONLY",
defs = [
"--polymer_version=1",
"--language_out=ECMASCRIPT6",
"--polymer_version=2",
"--language_out=ECMASCRIPT_2017",
"--rewrite_polyfills=false",
],
deps = [