Clean up Polymer1 and Polymer2 separation
Change-Id: I58a2bb3781ddd6080dec4f3e44a7f3ae8e1c219d
This commit is contained in:
@@ -112,9 +112,6 @@ public class IndexHtmlUtil {
|
|||||||
SanitizedContent sanitizedStaticPath = urlInScriptTagOrdainer.apply(staticPath);
|
SanitizedContent sanitizedStaticPath = urlInScriptTagOrdainer.apply(staticPath);
|
||||||
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
|
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
|
||||||
|
|
||||||
// TODO(taoalpha): Remove once p2 fully rolled out
|
|
||||||
data.put("polymer2", "true");
|
|
||||||
|
|
||||||
if (canonicalPath != null) {
|
if (canonicalPath != null) {
|
||||||
data.put("canonicalPath", canonicalPath);
|
data.put("canonicalPath", canonicalPath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public class IndexHtmlUtilTest {
|
|||||||
assertThat(
|
assertThat(
|
||||||
staticTemplateData(
|
staticTemplateData(
|
||||||
"http://example.com/", null, null, new HashMap<>(), IndexHtmlUtilTest::ordain))
|
"http://example.com/", null, null, new HashMap<>(), IndexHtmlUtilTest::ordain))
|
||||||
.containsExactly("canonicalPath", "", "polymer2", "true", "staticResourcePath", ordain(""));
|
.containsExactly("canonicalPath", "", "staticResourcePath", ordain(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -41,13 +41,7 @@ public class IndexHtmlUtilTest {
|
|||||||
null,
|
null,
|
||||||
new HashMap<>(),
|
new HashMap<>(),
|
||||||
IndexHtmlUtilTest::ordain))
|
IndexHtmlUtilTest::ordain))
|
||||||
.containsExactly(
|
.containsExactly("canonicalPath", "/gerrit", "staticResourcePath", ordain("/gerrit"));
|
||||||
"canonicalPath",
|
|
||||||
"/gerrit",
|
|
||||||
"polymer2",
|
|
||||||
"true",
|
|
||||||
"staticResourcePath",
|
|
||||||
ordain("/gerrit"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -60,12 +54,7 @@ public class IndexHtmlUtilTest {
|
|||||||
new HashMap<>(),
|
new HashMap<>(),
|
||||||
IndexHtmlUtilTest::ordain))
|
IndexHtmlUtilTest::ordain))
|
||||||
.containsExactly(
|
.containsExactly(
|
||||||
"canonicalPath",
|
"canonicalPath", "", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
|
||||||
"",
|
|
||||||
"polymer2",
|
|
||||||
"true",
|
|
||||||
"staticResourcePath",
|
|
||||||
ordain("http://my-cdn.com/foo/bar/"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -78,12 +67,7 @@ public class IndexHtmlUtilTest {
|
|||||||
new HashMap<>(),
|
new HashMap<>(),
|
||||||
IndexHtmlUtilTest::ordain))
|
IndexHtmlUtilTest::ordain))
|
||||||
.containsExactly(
|
.containsExactly(
|
||||||
"canonicalPath",
|
"canonicalPath", "/gerrit", "staticResourcePath", ordain("http://my-cdn.com/foo/bar/"));
|
||||||
"/gerrit",
|
|
||||||
"polymer2",
|
|
||||||
"true",
|
|
||||||
"staticResourcePath",
|
|
||||||
ordain("http://my-cdn.com/foo/bar/"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SanitizedContent ordain(String s) {
|
private static SanitizedContent ordain(String s) {
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ polygerrit_bundle(
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
outs = ["polygerrit_ui.zip"],
|
outs = ["polygerrit_ui.zip"],
|
||||||
# TODO(taoalpha): replace with gr-app.html once p2 fully rolled out
|
app = "elements/gr-app.html",
|
||||||
app = "elements/gr-app-p2.html",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
bower_component_bundle(
|
bower_component_bundle(
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
<!--
|
|
||||||
@license
|
|
||||||
Copyright (C) 2019 The Android Open Source Project
|
|
||||||
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
TODO(taoalpha): This file only used by google,
|
|
||||||
remove once polymer 2 fully rolled out.
|
|
||||||
-->
|
|
||||||
<script>
|
|
||||||
window.Gerrit = window.Gerrit || {};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<link rel="import" href="/bower_components/polymer/polymer.html">
|
|
||||||
<link rel="import" href="/bower_components/polymer-resin/standalone/polymer-resin.html">
|
|
||||||
<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({
|
|
||||||
allowedIdentifierPrefixes: [''],
|
|
||||||
reportHandler: security.polymer_resin.CONSOLE_LOGGING_REPORT_HANDLER,
|
|
||||||
safeTypesBridge: Gerrit.SafeTypes.safeTypesBridge,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<link rel="import" href="./gr-app-element.html">
|
|
||||||
<dom-module id="gr-app-p2">
|
|
||||||
<template>
|
|
||||||
<gr-app-element id="app-element"></gr-app-element>
|
|
||||||
</template>
|
|
||||||
<script src="gr-app-p2.js" crossorigin="anonymous"></script>
|
|
||||||
</dom-module>
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/**
|
|
||||||
* @license
|
|
||||||
* Copyright (C) 2019 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// TODO(taoalpha): This file is only used by google,
|
|
||||||
// remove once polymer fully rolled out.
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
Polymer({
|
|
||||||
is: 'gr-app-p2',
|
|
||||||
});
|
|
||||||
})();
|
|
||||||
@@ -15,22 +15,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script>
|
<script>
|
||||||
// TODO(taoalpha): clean up after p2 fully rolled out
|
if (!window.Polymer) {
|
||||||
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 = {
|
window.Polymer = {
|
||||||
passiveTouchGestures: true,
|
passiveTouchGestures: true,
|
||||||
lazyRegister: true,
|
lazyRegister: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
window.Gerrit = window.Gerrit || {};
|
window.Gerrit = window.Gerrit || {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -17,15 +17,6 @@
|
|||||||
(function() {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Eagerly render Polymer components when backgrounded. (Skips
|
|
||||||
// requestAnimationFrame.)
|
|
||||||
// @see https://github.com/Polymer/polymer/issues/3851
|
|
||||||
// @see Issue 4699
|
|
||||||
// TODO(taoalpha): Remove once p2 fully rolled out
|
|
||||||
if (!window.POLYMER2) {
|
|
||||||
Polymer.RenderStatus._makeReady();
|
|
||||||
}
|
|
||||||
|
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'gr-app',
|
is: 'gr-app',
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -24,7 +24,6 @@
|
|||||||
{@param? assetsBundle: ?} /** {string} Assets bundle .html file, served from $assetsPath. */
|
{@param? assetsBundle: ?} /** {string} Assets bundle .html file, served from $assetsPath. */
|
||||||
{@param? faviconPath: ?}
|
{@param? faviconPath: ?}
|
||||||
{@param? versionInfo: ?}
|
{@param? versionInfo: ?}
|
||||||
{@param? polymer2: ?}
|
|
||||||
{@param? polyfillCE: ?}
|
{@param? polyfillCE: ?}
|
||||||
{@param? polyfillSD: ?}
|
{@param? polyfillSD: ?}
|
||||||
{@param? polyfillSC: ?}
|
{@param? polyfillSC: ?}
|
||||||
@@ -43,8 +42,6 @@
|
|||||||
// Disable extra font load from paper-styles
|
// Disable extra font load from paper-styles
|
||||||
window.polymerSkipLoadingFontRoboto = true;
|
window.polymerSkipLoadingFontRoboto = true;
|
||||||
window.CLOSURE_NO_DEPS = true;
|
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 $canonicalPath != ''}window.CANONICAL_PATH = '{$canonicalPath}';{/if}
|
||||||
{if $versionInfo}window.VERSION_INFO = '{$versionInfo}';{/if}
|
{if $versionInfo}window.VERSION_INFO = '{$versionInfo}';{/if}
|
||||||
{if $staticResourcePath != ''}window.STATIC_RESOURCE_PATH = '{$staticResourcePath}';{/if}
|
{if $staticResourcePath != ''}window.STATIC_RESOURCE_PATH = '{$staticResourcePath}';{/if}
|
||||||
@@ -94,17 +91,8 @@
|
|||||||
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
|
<link rel="import" href="{$assetsPath}/{$assetsBundle}">{\n}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
// TODO(taoalpha): only used by Google, remove once polymer 2 fully rolled out
|
|
||||||
{if $polymer2}
|
|
||||||
<link rel="import" href="{$staticResourcePath}/elements/gr-app-p2.html">{\n}
|
|
||||||
{else}
|
|
||||||
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
<link rel="import" href="{$staticResourcePath}/elements/gr-app.html">{\n}
|
||||||
{/if}
|
|
||||||
|
|
||||||
<body unresolved>{\n}
|
<body unresolved>{\n}
|
||||||
{if $polymer2}
|
|
||||||
<gr-app-p2 id="app"></gr-app-p2>{\n}
|
|
||||||
{else}
|
|
||||||
<gr-app id="app"></gr-app>{\n}
|
<gr-app id="app"></gr-app>{\n}
|
||||||
{/if}
|
|
||||||
{/template}
|
{/template}
|
||||||
|
|||||||
Reference in New Issue
Block a user