From fe225d48a18f722c03e31fdeb9c6c6c4ac6bb9d8 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 28 Aug 2021 14:31:58 +0300 Subject: feat(3p/gerrit): Upgrade Gerrit and plugins to v3.4.0 Brings us back to a stable version of Gerrit instead of a random commit. Note that Gerrit 3.4.1 is out, but due to a bug it can not be built publicly because it accidentally points at a private submodule (this is being fixed upstream). Change-Id: I0376c63a649498cef999dfa99bfccba511f2c8da Reviewed-on: https://cl.tvl.fyi/c/depot/+/3444 Tested-by: BuildkiteCI Reviewed-by: lukegb --- .../0001-Use-detzip-in-download_bower.py.patch | 8 +- third_party/gerrit/0002-Syntax-highlight-nix.patch | 4 +- .../gerrit/0003-Syntax-highlight-rules.pl.patch | 8 +- .../gerrit/0004-Add-titles-to-CLs-over-HTTP.patch | 10 +- ...local-fonts-always-assume-Gerrit-is-mount.patch | 4 +- .../gerrit/0006-Always-use-Google-Fonts.patch | 4 +- ...adding-on-account-chip-if-no-avatar-provi.patch | 4 +- third_party/gerrit/default.nix | 12 +- .../gerrit/polygerrit-revert-typescript.patch | 210 --------------------- 9 files changed, 27 insertions(+), 237 deletions(-) delete mode 100644 third_party/gerrit/polygerrit-revert-typescript.patch (limited to 'third_party/gerrit') diff --git a/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch index 491927d5ffac..7d197795b725 100644 --- a/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch +++ b/third_party/gerrit/0001-Use-detzip-in-download_bower.py.patch @@ -1,4 +1,4 @@ -From 6d8cfd8443bef47bfb106e2272e5e9d86c1fd291 Mon Sep 17 00:00:00 2001 +From 621cadcc1dd71e9397c21cf8cf0f1aae4f6f7057 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:09 +0100 Subject: [PATCH 1/7] Use detzip in download_bower.py @@ -8,10 +8,10 @@ Subject: [PATCH 1/7] Use detzip in download_bower.py 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/js/download_bower.py b/tools/js/download_bower.py -index 1df4b826bc..65bda74082 100755 +index d541b565a9..ffdae60f95 100755 --- a/tools/js/download_bower.py +++ b/tools/js/download_bower.py -@@ -106,7 +106,7 @@ def main(): +@@ -110,7 +110,7 @@ def main(): args.b, '--quiet', 'install', '%s#%s' % (args.p, args.v))) bc = os.path.join(cwd, 'bower_components') subprocess.check_call( @@ -21,5 +21,5 @@ index 1df4b826bc..65bda74082 100755 if args.s: -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0002-Syntax-highlight-nix.patch b/third_party/gerrit/0002-Syntax-highlight-nix.patch index 72142daf87e0..256da0a3c930 100644 --- a/third_party/gerrit/0002-Syntax-highlight-nix.patch +++ b/third_party/gerrit/0002-Syntax-highlight-nix.patch @@ -1,4 +1,4 @@ -From 556c4f189d0ed41fb5ad59545ffcf5e957bbb820 Mon Sep 17 00:00:00 2001 +From 924647c354576ade0dc46fdf30596967f58bb4c6 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:32 +0100 Subject: [PATCH 2/7] Syntax highlight nix @@ -20,5 +20,5 @@ index 081d28d749..2762ccc625 100644 const ASYNC_DELAY = 10; -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch index 096057f1ad4f..02bb3397eabb 100644 --- a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch +++ b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch @@ -1,4 +1,4 @@ -From 7c2e72527d177fd26505821e6297e6aa270a4f96 Mon Sep 17 00:00:00 2001 +From be348f64eda257ae0af1f89552548d3e8eca3688 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:43 +0100 Subject: [PATCH 3/7] Syntax highlight rules.pl @@ -8,7 +8,7 @@ Subject: [PATCH 3/7] Syntax highlight rules.pl 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts -index 2762ccc625..ebb5d9dad9 100644 +index 2762ccc625..598e14589f 100644 --- a/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts +++ b/polygerrit-ui/app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts @@ -103,6 +103,10 @@ const LANGUAGE_MAP = new Map([ @@ -35,12 +35,12 @@ index 2762ccc625..ebb5d9dad9 100644 // The Gerrit API provides only content-type, but for other users of // gr-diff it may be more convenient to specify the language directly. - return metaInfo.language ?? LANGUAGE_MAP.get(metaInfo.content_type); -+ return metaInfo.language ?? ++ return metaInfo.language ?? + FILENAME_OVERRIDES.get(this._basename(metaInfo.name)) ?? + LANGUAGE_MAP.get(metaInfo.content_type); } /** -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch index 07c527b5fd52..8e78e5f535e3 100644 --- a/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch +++ b/third_party/gerrit/0004-Add-titles-to-CLs-over-HTTP.patch @@ -1,4 +1,4 @@ -From 152fd4ed4cc45d467fd56945debb759870cd53ca Mon Sep 17 00:00:00 2001 +From 32bf13d8316f93828d2ff47ccfca38d4e7a634b1 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:03:02 +0100 Subject: [PATCH 4/7] Add titles to CLs over HTTP @@ -102,10 +102,10 @@ index 3f2c2028ae..7861c007df 100644 } catch (URISyntaxException | RestApiException e) { throw new IOException(e); diff --git a/java/com/google/gerrit/httpd/raw/StaticModule.java b/java/com/google/gerrit/httpd/raw/StaticModule.java -index cac716feb9..6b17d8ea6f 100644 +index bb1eb92525..6b20c504d2 100644 --- a/java/com/google/gerrit/httpd/raw/StaticModule.java +++ b/java/com/google/gerrit/httpd/raw/StaticModule.java -@@ -223,11 +223,13 @@ public class StaticModule extends ServletModule { +@@ -224,11 +224,13 @@ public class StaticModule extends ServletModule { @CanonicalWebUrl @Nullable String canonicalUrl, @GerritServerConfig Config cfg, GerritApi gerritApi, @@ -195,7 +195,7 @@ index 0000000000..8fd2053ad0 + } +} diff --git a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy -index 93584c6b05..6e6a1e5401 100644 +index 11717fb8a4..1ae9046360 100644 --- a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy +++ b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy @@ -33,10 +33,12 @@ @@ -213,5 +213,5 @@ index 93584c6b05..6e6a1e5401 100644 {\n} -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch b/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch index 67c4256f56c8..b664ea0ea6b2 100644 --- a/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch +++ b/third_party/gerrit/0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch @@ -1,4 +1,4 @@ -From 99c2363205a3bc9d7f8822274dd270ee2e027728 Mon Sep 17 00:00:00 2001 +From bd7db44cabb6de64f03adbaf5e24c73e022a8932 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 11 Jul 2020 00:45:57 +0000 Subject: [PATCH 5/7] When using local fonts, always assume Gerrit is mounted @@ -22,5 +22,5 @@ index d93b5eab39..c862c9bbae 100644 return null; } -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0006-Always-use-Google-Fonts.patch b/third_party/gerrit/0006-Always-use-Google-Fonts.patch index 6e99412499e1..5b817d0b55a3 100644 --- a/third_party/gerrit/0006-Always-use-Google-Fonts.patch +++ b/third_party/gerrit/0006-Always-use-Google-Fonts.patch @@ -1,4 +1,4 @@ -From e5c8621646bbde242453a1ac6b0b82f6279789e0 Mon Sep 17 00:00:00 2001 +From d71f51afe12a280b92831070a583b15c8b6bc2f4 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 11 Jul 2020 00:46:13 +0000 Subject: [PATCH 6/7] Always use Google Fonts. @@ -24,5 +24,5 @@ index a9cfceb3b6..9c287c6e45 100644 } -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/0007-Keep-left-padding-on-account-chip-if-no-avatar-provi.patch b/third_party/gerrit/0007-Keep-left-padding-on-account-chip-if-no-avatar-provi.patch index 7a4acf60cb70..63f269167a0a 100644 --- a/third_party/gerrit/0007-Keep-left-padding-on-account-chip-if-no-avatar-provi.patch +++ b/third_party/gerrit/0007-Keep-left-padding-on-account-chip-if-no-avatar-provi.patch @@ -1,4 +1,4 @@ -From 8258bb2deef504656d7b79868dcacdcd00fa1778 Mon Sep 17 00:00:00 2001 +From 9062a3705c67f576a2484fe69a39847ae7ff293a Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 20 Dec 2020 14:29:22 +0000 Subject: [PATCH 7/7] Keep left padding on account chip if no avatar provider @@ -107,5 +107,5 @@ index f37aa01a2d..4a21222dca 100644 test('not showing anonymous', () => { const account = {name: 'Wyatt'}; -- -2.29.2 +2.32.0 diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix index 71a0c44ac948..6afc8813a936 100644 --- a/third_party/gerrit/default.nix +++ b/third_party/gerrit/default.nix @@ -28,7 +28,7 @@ let runScript = "/bin/bazel-run"; }; bazel = bazelTop // { override = x: bazelTop; }; - version = "3.3.2-1990-gabb30fe7f1"; + version = "3.4.0"; in pkgs.lib.makeOverridable pkgs.buildBazelPackage { pname = "gerrit"; @@ -36,10 +36,12 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { src = pkgs.fetchgit { url = "https://gerrit.googlesource.com/gerrit"; - rev = "abb30fe7f1ecf07d7b5098d6ad7e4423389c41e5"; - sha256 = "sha256:0xsxhqyjl2dd1wglfk43b8c7591l2x5ikb4l7nxi96czladqy82v"; + rev = "471c1c15a7bc294d10e246df43812942b5ac8a13"; + branchName = "v${version}"; + sha256 = "sha256:0ayj0bcsxjln8qydkj9j7yiqibmjgd3bcpqvgsdzdx072wzx01c0"; fetchSubmodules = true; }; + patches = [ ./0001-Use-detzip-in-download_bower.py.patch ./0002-Syntax-highlight-nix.patch @@ -48,8 +50,6 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { ./0005-When-using-local-fonts-always-assume-Gerrit-is-mount.patch ./0006-Always-use-Google-Fonts.patch ./0007-Keep-left-padding-on-account-chip-if-no-avatar-provi.patch - - ./polygerrit-revert-typescript.patch ]; bazelTarget = "release api-skip-javadoc"; @@ -63,7 +63,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { fetchConfigured = true; fetchAttrs = { - sha256 = "sha256:0i40brj8c49920fhl7h84rlbg1i4bz5c0p7sflm7h9m5m6jr8a1y"; + sha256 = "sha256:16a1lbz40bc7217ldwf7x8yzlzxc714h965ldjnmfbvi3jq3hk6y"; preBuild = '' rm .bazelversion ''; diff --git a/third_party/gerrit/polygerrit-revert-typescript.patch b/third_party/gerrit/polygerrit-revert-typescript.patch deleted file mode 100644 index 4f549ee554d7..000000000000 --- a/third_party/gerrit/polygerrit-revert-typescript.patch +++ /dev/null @@ -1,210 +0,0 @@ -commit a969f220b8e6e0e8b9f3bab2b1f0b7ec20c3be94 -Author: David Ostrovsky -Date: Mon Mar 29 08:29:17 2021 +0000 - - Revert "Convert gr-app_test to typescript" - - This reverts commit 56fa576885bf7fbddd38a8af2404ea7e5d1d625f. - - Reason for revert: It broke PolyGerrit UI. - - Bug: Issue 14300 - Change-Id: Ice0a70801dad8daea0822ce489ae24892c08ebcd - -diff --git a/polygerrit-ui/app/elements/gr-app.ts b/polygerrit-ui/app/elements/gr-app.ts -index 463fab920f..2d3289d479 100644 ---- a/polygerrit-ui/app/elements/gr-app.ts -+++ b/polygerrit-ui/app/elements/gr-app.ts -@@ -45,7 +45,7 @@ import {installPolymerResin} from '../scripts/polymer-resin-install'; - installPolymerResin(safeTypesBridge); - - @customElement('gr-app') --export class GrApp extends PolymerElement { -+class GrApp extends PolymerElement { - static get template() { - return htmlTemplate; - } -diff --git a/polygerrit-ui/app/elements/gr-app_test.js b/polygerrit-ui/app/elements/gr-app_test.js -new file mode 100644 -index 0000000000..8178c89732 ---- /dev/null -+++ b/polygerrit-ui/app/elements/gr-app_test.js -@@ -0,0 +1,77 @@ -+/** -+ * @license -+ * Copyright (C) 2016 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. -+ */ -+ -+import '../test/common-test-setup-karma.js'; -+import './gr-app.js'; -+import {appContext} from '../services/app-context.js'; -+import {GerritNav} from './core/gr-navigation/gr-navigation.js'; -+import {html} from '@polymer/polymer/lib/utils/html-tag.js'; -+import {stubRestApi} from '../test/test-utils.js'; -+ -+const basicFixture = fixtureFromTemplate(html``); -+ -+suite('gr-app tests', () => { -+ let element; -+ let configStub; -+ -+ setup(done => { -+ sinon.stub(appContext.reportingService, 'appStarted'); -+ stub('gr-account-dropdown', '_getTopContent'); -+ stub('gr-router', 'start'); -+ stubRestApi('getAccount').returns(Promise.resolve({})); -+ stubRestApi('getAccountCapabilities').returns(Promise.resolve({})); -+ configStub = stubRestApi('getConfig').returns(Promise.resolve({ -+ plugin: {}, -+ auth: { -+ auth_type: undefined, -+ }, -+ })); -+ stubRestApi('getPreferences').returns(Promise.resolve({my: []})); -+ stubRestApi('getVersion').returns(Promise.resolve(42)); -+ stubRestApi('probePath').returns(Promise.resolve(42)); -+ -+ element = basicFixture.instantiate(); -+ flush(done); -+ }); -+ -+ const appElement = () => element.$['app-element']; -+ -+ test('reporting', () => { -+ assert.isTrue(appElement().reporting.appStarted.calledOnce); -+ }); -+ -+ test('reporting called before router start', () => { -+ const element = appElement(); -+ const appStartedStub = element.reporting.appStarted; -+ const routerStartStub = element.$.router.start; -+ sinon.assert.callOrder(appStartedStub, routerStartStub); -+ }); -+ -+ test('passes config to gr-plugin-host', () => -+ configStub.lastCall.returnValue.then(config => { -+ assert.deepEqual(appElement().$.plugins.config, config); -+ }) -+ ); -+ -+ test('_paramsChanged sets search page', () => { -+ appElement()._paramsChanged({base: {view: GerritNav.View.CHANGE}}); -+ assert.notOk(appElement()._lastSearchPage); -+ appElement()._paramsChanged({base: {view: GerritNav.View.SEARCH}}); -+ assert.ok(appElement()._lastSearchPage); -+ }); -+}); -+ -diff --git a/polygerrit-ui/app/elements/gr-app_test.ts b/polygerrit-ui/app/elements/gr-app_test.ts -deleted file mode 100644 -index 3583a6a3a2..0000000000 ---- a/polygerrit-ui/app/elements/gr-app_test.ts -+++ /dev/null -@@ -1,82 +0,0 @@ --/** -- * @license -- * Copyright (C) 2016 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. -- */ -- --import '../test/common-test-setup-karma'; --import {GrApp} from './gr-app'; --import {appContext} from '../services/app-context'; --import {html} from '@polymer/polymer/lib/utils/html-tag'; --import {queryAndAssert} from '../test/test-utils'; --import {createServerInfo} from '../test/test-data-generators'; --import {GrAppElement} from './gr-app-element'; --import {GrPluginHost} from './plugins/gr-plugin-host/gr-plugin-host'; --import {GerritView} from '../services/router/router-model'; --import { -- AppElementChangeViewParams, -- AppElementSearchParam, --} from './gr-app-types'; --import {GrRouter} from './core/gr-router/gr-router'; --import {ReportingService} from '../services/gr-reporting/gr-reporting'; -- --const basicFixture = fixtureFromTemplate(html``); -- --suite('gr-app tests', () => { -- let element: GrApp; -- let appStartedStub: sinon.SinonStubbedMember; -- let routerStartStub: sinon.SinonStubbedMember; -- -- setup(done => { -- appStartedStub = sinon.stub(appContext.reportingService, 'appStarted'); -- routerStartStub = stub('gr-router', 'start'); -- stub('gr-account-dropdown', '_getTopContent'); -- -- element = basicFixture.instantiate() as GrApp; -- flush(done); -- }); -- -- const appElement = () => -- queryAndAssert(element, '#app-element'); -- -- test('reporting', () => { -- assert.isTrue(appStartedStub.calledOnce); -- }); -- -- test('reporting called before router start', () => { -- sinon.assert.callOrder(appStartedStub, routerStartStub); -- }); -- -- test('passes config to gr-plugin-host', () => { -- assert.deepEqual( -- queryAndAssert(appElement(), 'gr-plugin-host').config, -- createServerInfo() -- ); -- }); -- -- test('_paramsChanged sets search page', () => { -- appElement()._paramsChanged({ -- path: '', -- value: undefined, -- base: {view: GerritView.CHANGE} as AppElementChangeViewParams, -- }); -- assert.notOk(appElement()._lastSearchPage); -- appElement()._paramsChanged({ -- path: '', -- value: undefined, -- base: {view: GerritView.SEARCH} as AppElementSearchParam, -- }); -- assert.ok(appElement()._lastSearchPage); -- }); --}); -diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts -index 651eac4e28..ac493a2556 100644 ---- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts -+++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.ts -@@ -20,7 +20,7 @@ import {customElement, property} from '@polymer/decorators'; - import {ServerInfo} from '../../../types/common'; - - @customElement('gr-plugin-host') --export class GrPluginHost extends PolymerElement { -+class GrPluginHost extends PolymerElement { - @property({type: Object, observer: '_configChanged'}) - config?: ServerInfo; - -- cgit 1.4.1