From f59c6214c4b1812120bd500a23d1cb6e160d6665 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 3 Apr 2021 23:20:28 +0000 Subject: chore(3p/gerrit): update gerrit and plugins Yeet. Change-Id: I4de6453419f520a44af19d561a36d242195a64e9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2817 Tested-by: BuildkiteCI Reviewed-by: tazjin --- .../0001-Use-detzip-in-download_bower.py.patch | 4 +- third_party/gerrit/0002-Syntax-highlight-nix.patch | 8 +-- .../gerrit/0003-Syntax-highlight-rules.pl.patch | 10 ++-- .../gerrit/0004-Add-titles-to-CLs-over-HTTP.patch | 65 +++++++++++----------- ...local-fonts-always-assume-Gerrit-is-mount.patch | 6 +- .../gerrit/0006-Always-use-Google-Fonts.patch | 8 +-- ...adding-on-account-chip-if-no-avatar-provi.patch | 12 ++-- third_party/gerrit/default.nix | 6 +- 8 files changed, 61 insertions(+), 58 deletions(-) (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 3fabbd8294ec..491927d5ffac 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,7 +1,7 @@ -From 9467d1138799d0fc127f9e1e09cf2afd9b85de79 Mon Sep 17 00:00:00 2001 +From 6d8cfd8443bef47bfb106e2272e5e9d86c1fd291 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:09 +0100 -Subject: [PATCH 1/6] Use detzip in download_bower.py +Subject: [PATCH 1/7] Use detzip in download_bower.py --- tools/js/download_bower.py | 2 +- diff --git a/third_party/gerrit/0002-Syntax-highlight-nix.patch b/third_party/gerrit/0002-Syntax-highlight-nix.patch index 98d09405af60..72142daf87e0 100644 --- a/third_party/gerrit/0002-Syntax-highlight-nix.patch +++ b/third_party/gerrit/0002-Syntax-highlight-nix.patch @@ -1,17 +1,17 @@ -From 27575eba5e812c4e86aa35f32e2958758312cf87 Mon Sep 17 00:00:00 2001 +From 556c4f189d0ed41fb5ad59545ffcf5e957bbb820 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:32 +0100 -Subject: [PATCH 2/6] Syntax highlight nix +Subject: [PATCH 2/7] Syntax highlight nix --- .../app/elements/diff/gr-syntax-layer/gr-syntax-layer.ts | 1 + 1 file changed, 1 insertion(+) 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 f5e5e047bc..0c3bb40ce4 100644 +index 081d28d749..2762ccc625 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 -@@ -105,6 +105,7 @@ const LANGUAGE_MAP = new Map([ +@@ -99,6 +99,7 @@ const LANGUAGE_MAP = new Map([ ['text/x-vhdl', 'vhdl'], ['text/x-yaml', 'yaml'], ['text/vbscript', 'vbscript'], diff --git a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch index f77f5c8f6aa5..096057f1ad4f 100644 --- a/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch +++ b/third_party/gerrit/0003-Syntax-highlight-rules.pl.patch @@ -1,17 +1,17 @@ -From a76aba976de1a1e46c5aeb8772f3f2d58c7efda4 Mon Sep 17 00:00:00 2001 +From 7c2e72527d177fd26505821e6297e6aa270a4f96 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:02:43 +0100 -Subject: [PATCH 3/6] Syntax highlight rules.pl +Subject: [PATCH 3/7] Syntax highlight rules.pl --- .../diff/gr-syntax-layer/gr-syntax-layer.ts | 13 ++++++++++++- 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 0c3bb40ce4..ace253da30 100644 +index 2762ccc625..ebb5d9dad9 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 -@@ -109,6 +109,10 @@ const LANGUAGE_MAP = new Map([ +@@ -103,6 +103,10 @@ const LANGUAGE_MAP = new Map([ ]); const ASYNC_DELAY = 10; @@ -22,7 +22,7 @@ index 0c3bb40ce4..ace253da30 100644 const CLASS_SAFELIST = new Set([ 'gr-diff gr-syntax gr-syntax-attr', 'gr-diff gr-syntax gr-syntax-attribute', -@@ -258,10 +262,17 @@ export class GrSyntaxLayer +@@ -241,10 +245,17 @@ export class GrSyntaxLayer implements DiffLayer { } } 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 a6395b5444fc..07c527b5fd52 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,22 +1,22 @@ -From 97c5e78c42fe70e3f9cd9bc37129700067525967 Mon Sep 17 00:00:00 2001 +From 152fd4ed4cc45d467fd56945debb759870cd53ca Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Thu, 2 Jul 2020 23:03:02 +0100 -Subject: [PATCH 4/6] Add titles to CLs over HTTP +Subject: [PATCH 4/7] Add titles to CLs over HTTP --- .../gerrit/httpd/raw/IndexHtmlUtil.java | 13 +++- - .../google/gerrit/httpd/raw/IndexServlet.java | 7 +- - .../google/gerrit/httpd/raw/StaticModule.java | 5 +- + .../google/gerrit/httpd/raw/IndexServlet.java | 8 ++- + .../google/gerrit/httpd/raw/StaticModule.java | 6 +- .../gerrit/httpd/raw/TitleComputer.java | 67 +++++++++++++++++++ .../gerrit/httpd/raw/PolyGerritIndexHtml.soy | 4 +- - 5 files changed, 88 insertions(+), 8 deletions(-) + 5 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 java/com/google/gerrit/httpd/raw/TitleComputer.java diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java -index 77d02c16d0..3b2cae702a 100644 +index 8d52f5ad50..a9cfceb3b6 100644 --- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java +++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java -@@ -38,6 +38,7 @@ import java.util.Arrays; +@@ -39,6 +39,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; @@ -24,7 +24,7 @@ index 77d02c16d0..3b2cae702a 100644 import java.util.Set; import java.util.function.Function; -@@ -58,13 +59,14 @@ public class IndexHtmlUtil { +@@ -60,13 +61,14 @@ public class IndexHtmlUtil { String faviconPath, Map urlParameterMap, Function urlInScriptTagOrdainer, @@ -38,10 +38,10 @@ index 77d02c16d0..3b2cae702a 100644 canonicalURL, cdnPath, faviconPath, urlParameterMap, urlInScriptTagOrdainer)) - .putAll(dynamicTemplateData(gerritApi, requestedURL)); + .putAll(dynamicTemplateData(gerritApi, requestedURL, titleComputer)); + Set enabledExperiments = experimentFeatures.getEnabledExperimentFeatures(); - Set enabledExperiments = experimentData(urlParameterMap); if (!enabledExperiments.isEmpty()) { -@@ -75,7 +77,9 @@ public class IndexHtmlUtil { +@@ -77,7 +79,9 @@ public class IndexHtmlUtil { /** Returns dynamic parameters of {@code index.html}. */ public static ImmutableMap dynamicTemplateData( @@ -52,7 +52,7 @@ index 77d02c16d0..3b2cae702a 100644 ImmutableMap.Builder data = ImmutableMap.builder(); Map initialData = new HashMap<>(); Server serverApi = gerritApi.config().server(); -@@ -126,6 +130,9 @@ public class IndexHtmlUtil { +@@ -128,6 +132,9 @@ public class IndexHtmlUtil { // Don't render data } @@ -63,11 +63,11 @@ index 77d02c16d0..3b2cae702a 100644 return data.build(); } diff --git a/java/com/google/gerrit/httpd/raw/IndexServlet.java b/java/com/google/gerrit/httpd/raw/IndexServlet.java -index 97d22701de..089ef4725f 100644 +index 3f2c2028ae..7861c007df 100644 --- a/java/com/google/gerrit/httpd/raw/IndexServlet.java +++ b/java/com/google/gerrit/httpd/raw/IndexServlet.java -@@ -44,12 +44,14 @@ public class IndexServlet extends HttpServlet { - private final GerritApi gerritApi; +@@ -46,13 +46,15 @@ public class IndexServlet extends HttpServlet { + private final ExperimentFeatures experimentFeatures; private final SoySauce soySauce; private final Function urlOrdainer; + private TitleComputer titleComputer; @@ -76,13 +76,14 @@ index 97d22701de..089ef4725f 100644 @Nullable String canonicalUrl, @Nullable String cdnPath, @Nullable String faviconPath, -- GerritApi gerritApi) { -+ GerritApi gerritApi, + GerritApi gerritApi, +- ExperimentFeatures experimentFeatures) { ++ ExperimentFeatures experimentFeatures, + TitleComputer titleComputer) { this.canonicalUrl = canonicalUrl; this.cdnPath = cdnPath; this.faviconPath = faviconPath; -@@ -63,6 +65,7 @@ public class IndexServlet extends HttpServlet { +@@ -67,6 +69,7 @@ public class IndexServlet extends HttpServlet { (s) -> UnsafeSanitizedContentOrdainer.ordainAsSafe( s, SanitizedContent.ContentKind.TRUSTED_RESOURCE_URI); @@ -90,31 +91,33 @@ index 97d22701de..089ef4725f 100644 } @Override -@@ -74,7 +77,7 @@ public class IndexServlet extends HttpServlet { - // TODO(hiesel): Remove URL ordainer as parameter once Soy is consistent - ImmutableMap templateData = - IndexHtmlUtil.templateData( -- gerritApi, canonicalUrl, cdnPath, faviconPath, parameterMap, urlOrdainer, requestUrl); -+ gerritApi, canonicalUrl, cdnPath, faviconPath, parameterMap, urlOrdainer, requestUrl, titleComputer); +@@ -85,7 +88,8 @@ public class IndexServlet extends HttpServlet { + faviconPath, + parameterMap, + urlOrdainer, +- requestUrl); ++ requestUrl, ++ titleComputer); renderer = soySauce.renderTemplate("com.google.gerrit.httpd.raw.Index").setData(templateData); } 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 4b2c8a9733..466fbaa27c 100644 +index cac716feb9..6b17d8ea6f 100644 --- a/java/com/google/gerrit/httpd/raw/StaticModule.java +++ b/java/com/google/gerrit/httpd/raw/StaticModule.java -@@ -221,11 +221,12 @@ public class StaticModule extends ServletModule { - HttpServlet getPolyGerritUiIndexServlet( +@@ -223,11 +223,13 @@ public class StaticModule extends ServletModule { @CanonicalWebUrl @Nullable String canonicalUrl, @GerritServerConfig Config cfg, -- GerritApi gerritApi) { -+ GerritApi gerritApi, + GerritApi gerritApi, +- ExperimentFeatures experimentFeatures) { ++ ExperimentFeatures experimentFeatures, + TitleComputer titleComputer) { String cdnPath = options.useDevCdn() ? options.devCdn() : cfg.getString("gerrit", null, "cdnPath"); String faviconPath = cfg.getString("gerrit", null, "faviconPath"); -- return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi); -+ return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, titleComputer); +- return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, experimentFeatures); ++ return new IndexServlet(canonicalUrl, cdnPath, faviconPath, gerritApi, ++ experimentFeatures, titleComputer); } @Provides @@ -192,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 31ea7d2175..abadd089b4 100644 +index 93584c6b05..6e6a1e5401 100644 --- a/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy +++ b/resources/com/google/gerrit/httpd/raw/PolyGerritIndexHtml.soy @@ -33,10 +33,12 @@ 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 a9fb2f042b22..67c4256f56c8 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,7 +1,7 @@ -From f73b313cfeb94005136d55098460f51b17ff6556 Mon Sep 17 00:00:00 2001 +From 99c2363205a3bc9d7f8822274dd270ee2e027728 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 11 Jul 2020 00:45:57 +0000 -Subject: [PATCH 5/6] When using local fonts, always assume Gerrit is mounted +Subject: [PATCH 5/7] When using local fonts, always assume Gerrit is mounted at the root. --- @@ -9,7 +9,7 @@ Subject: [PATCH 5/6] When using local fonts, always assume Gerrit is mounted 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polygerrit-ui/app/rollup.config.js b/polygerrit-ui/app/rollup.config.js -index c8e9baa98c..9438504bd8 100644 +index d93b5eab39..c862c9bbae 100644 --- a/polygerrit-ui/app/rollup.config.js +++ b/polygerrit-ui/app/rollup.config.js @@ -50,7 +50,7 @@ const importLocalFontMetaUrlResolver = function() { diff --git a/third_party/gerrit/0006-Always-use-Google-Fonts.patch b/third_party/gerrit/0006-Always-use-Google-Fonts.patch index 5263ce114785..6e99412499e1 100644 --- a/third_party/gerrit/0006-Always-use-Google-Fonts.patch +++ b/third_party/gerrit/0006-Always-use-Google-Fonts.patch @@ -1,7 +1,7 @@ -From 1705c2634a2271659e3baf6b6c35f2e63bf05736 Mon Sep 17 00:00:00 2001 +From e5c8621646bbde242453a1ac6b0b82f6279789e0 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sat, 11 Jul 2020 00:46:13 +0000 -Subject: [PATCH 6/6] Always use Google Fonts. +Subject: [PATCH 6/7] Always use Google Fonts. We're not a corporate, and we're not behind the GFW. Always use Google Fonts, because even though we no longer get the caching benefits (boo, browsers), @@ -11,10 +11,10 @@ it is still a better geographically-distributed CDN. 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java -index 3b2cae702a..84ce678b6d 100644 +index a9cfceb3b6..9c287c6e45 100644 --- a/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java +++ b/java/com/google/gerrit/httpd/raw/IndexHtmlUtil.java -@@ -182,7 +182,7 @@ public class IndexHtmlUtil { +@@ -184,7 +184,7 @@ public class IndexHtmlUtil { if (urlParameterMap.containsKey("ce")) { data.put("polyfillCE", "true"); } 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 2ceeb1310686..7a4acf60cb70 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,7 +1,7 @@ -From e796e238d8fcf442443f66de2fd0f3944473fd44 Mon Sep 17 00:00:00 2001 +From 8258bb2deef504656d7b79868dcacdcd00fa1778 Mon Sep 17 00:00:00 2001 From: Luke Granger-Brown Date: Sun, 20 Dec 2020 14:29:22 +0000 -Subject: [PATCH 7/6] Keep left padding on account chip if no avatar provider +Subject: [PATCH 7/7] Keep left padding on account chip if no avatar provider present At the moment, if there's no plugin that provides avatars then the left @@ -15,10 +15,10 @@ Change-Id: I1ff0745aa267d7fb227e39460c8ea80ef5ec2f55 2 files changed, 69 insertions(+) diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts -index a6c4201a66..416a77526d 100644 +index 64bae58c41..220fcf413b 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts +++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label.ts -@@ -147,7 +147,13 @@ export class GrAccountLabel extends GestureEventListeners( +@@ -151,7 +151,13 @@ export class GrAccountLabel extends PolymerElement { change: ChangeInfo, force: boolean ) { @@ -33,10 +33,10 @@ index a6c4201a66..416a77526d 100644 !this._hasAttention(config, highlight, account, change, force) ); diff --git a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js -index 42b1dd7184..111d0550cd 100644 +index f37aa01a2d..4a21222dca 100644 --- a/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js +++ b/polygerrit-ui/app/elements/shared/gr-account-label/gr-account-label_test.js -@@ -46,6 +46,69 @@ suite('gr-account-label tests', () => { +@@ -44,6 +44,69 @@ suite('gr-account-label tests', () => { }); }); diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix index fa0672623520..f38331d5fb33 100644 --- a/third_party/gerrit/default.nix +++ b/third_party/gerrit/default.nix @@ -36,8 +36,8 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { src = pkgs.fetchgit { url = "https://gerrit.googlesource.com/gerrit"; - rev = "595e6db974449ff278709f5e87cd8d42199305fc"; - sha256 = "sha256:17mad9k41rvnzq91nr9w2lax6rdk7pgf20qc4chajay99faimhph"; + rev = "abb30fe7f1ecf07d7b5098d6ad7e4423389c41e5"; + sha256 = "sha256:0xsxhqyjl2dd1wglfk43b8c7591l2x5ikb4l7nxi96czladqy82v"; fetchSubmodules = true; }; patches = [ @@ -61,7 +61,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { fetchConfigured = true; fetchAttrs = { - sha256 = "sha256:0jlaylzbl2yscdfji77g1k4r3lcdmjxfbcxpnpwbcs83zpg8rsmf"; + sha256 = "sha256:18grb9fghrh84a08f2jqv3wrbf37bk9v1iy2bcaj6xq2phdbkr10"; preBuild = '' rm .bazelversion ''; -- cgit 1.4.1