chore(3p/gerrit): update gerrit and plugins
This reverts commit 9551b628d0
(i.e. this is a rollfoward for https://cl.tvl.fyi/c/depot/+/2817)
Change-Id: Iaffcf1cdbe119d26ecb09cc88f9a56436b374c08
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2870
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
This commit is contained in:
parent
435b883f5c
commit
0dba3ce133
11 changed files with 281 additions and 66 deletions
|
@ -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 <git@lukegb.com>
|
||||
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 +-
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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<string, string>([
|
||||
@@ -99,6 +99,7 @@ const LANGUAGE_MAP = new Map<string, string>([
|
||||
['text/x-vhdl', 'vhdl'],
|
||||
['text/x-yaml', 'yaml'],
|
||||
['text/vbscript', 'vbscript'],
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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<string, string>([
|
||||
@@ -103,6 +103,10 @@ const LANGUAGE_MAP = new Map<string, string>([
|
||||
]);
|
||||
const ASYNC_DELAY = 10;
|
||||
|
||||
|
@ -22,7 +22,7 @@ index 0c3bb40ce4..ace253da30 100644
|
|||
const CLASS_SAFELIST = new Set<string>([
|
||||
'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 {
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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<String, String[]> urlParameterMap,
|
||||
Function<String, SanitizedContent> urlInScriptTagOrdainer,
|
||||
|
@ -38,10 +38,10 @@ index 77d02c16d0..3b2cae702a 100644
|
|||
canonicalURL, cdnPath, faviconPath, urlParameterMap, urlInScriptTagOrdainer))
|
||||
- .putAll(dynamicTemplateData(gerritApi, requestedURL));
|
||||
+ .putAll(dynamicTemplateData(gerritApi, requestedURL, titleComputer));
|
||||
Set<String> enabledExperiments = experimentFeatures.getEnabledExperimentFeatures();
|
||||
|
||||
Set<String> 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<String, Object> dynamicTemplateData(
|
||||
|
@ -52,7 +52,7 @@ index 77d02c16d0..3b2cae702a 100644
|
|||
ImmutableMap.Builder<String, Object> data = ImmutableMap.builder();
|
||||
Map<String, SanitizedContent> 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<String, SanitizedContent> 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<String, Object> 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 @@
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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() {
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -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 <git@lukegb.com>
|
||||
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', () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
|
10
third_party/gerrit/default.nix
vendored
10
third_party/gerrit/default.nix
vendored
|
@ -28,7 +28,7 @@ let
|
|||
runScript = "/bin/bazel-run";
|
||||
};
|
||||
bazel = bazelTop // { override = x: bazelTop; };
|
||||
version = "3.3.0-rc7-520-gdef99cd679";
|
||||
version = "3.3.2-1990-gabb30fe7f1";
|
||||
in
|
||||
pkgs.lib.makeOverridable pkgs.buildBazelPackage {
|
||||
pname = "gerrit";
|
||||
|
@ -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 = [
|
||||
|
@ -48,6 +48,8 @@ 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";
|
||||
|
@ -61,7 +63,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage {
|
|||
fetchConfigured = true;
|
||||
|
||||
fetchAttrs = {
|
||||
sha256 = "sha256:0jlaylzbl2yscdfji77g1k4r3lcdmjxfbcxpnpwbcs83zpg8rsmf";
|
||||
sha256 = "sha256:18grb9fghrh84a08f2jqv3wrbf37bk9v1iy2bcaj6xq2phdbkr10";
|
||||
preBuild = ''
|
||||
rm .bazelversion
|
||||
'';
|
||||
|
|
210
third_party/gerrit/polygerrit-revert-typescript.patch
vendored
Normal file
210
third_party/gerrit/polygerrit-revert-typescript.patch
vendored
Normal file
|
@ -0,0 +1,210 @@
|
|||
commit a969f220b8e6e0e8b9f3bab2b1f0b7ec20c3be94
|
||||
Author: David Ostrovsky <david@ostrovsky.org>
|
||||
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`<gr-app id="app"></gr-app>`);
|
||||
+
|
||||
+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`<gr-app id="app"></gr-app>`);
|
||||
-
|
||||
-suite('gr-app tests', () => {
|
||||
- let element: GrApp;
|
||||
- let appStartedStub: sinon.SinonStubbedMember<ReportingService['appStarted']>;
|
||||
- let routerStartStub: sinon.SinonStubbedMember<GrRouter['start']>;
|
||||
-
|
||||
- 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<GrAppElement>(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<GrPluginHost>(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;
|
||||
|
12
third_party/gerrit_plugins/default.nix
vendored
12
third_party/gerrit_plugins/default.nix
vendored
|
@ -6,11 +6,11 @@ in depot.nix.utils.drvTargets {
|
|||
# https://gerrit.googlesource.com/plugins/owners
|
||||
owners = buildGerritBazelPlugin rec {
|
||||
name = "owners";
|
||||
depsOutputHash = "sha256:1cffbbn687dcl46jm70fd5h6an7jwalssvy0y1aqnhrwmbr4gwi9";
|
||||
depsOutputHash = "sha256:0j7hn945l5y5pz109mrcx2hh2lb2gi5gf4wrrbypx43rmyhlz3s8";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gerrit.googlesource.com/plugins/owners";
|
||||
rev = "17817c9e319073c03513f9d5177b6142b8fd567b";
|
||||
sha256 = "sha256:06j1wp5xpwabmzyhjjl5rcmgsxqi8ffzgzf8avbr61qzgh76f22n";
|
||||
rev = "f3335231b98e14664fdd1b325486bb0824800ac3";
|
||||
sha256 = "sha256:0dqf36wn6gnkwia3529dwlcib2np78dgsjs7dymg5isy1i8p655f";
|
||||
};
|
||||
overlayPluginCmd = ''
|
||||
chmod +w "$out" "$out/plugins/external_plugin_deps.bzl"
|
||||
|
@ -23,11 +23,11 @@ in depot.nix.utils.drvTargets {
|
|||
# https://gerrit.googlesource.com/plugins/checks
|
||||
checks = buildGerritBazelPlugin {
|
||||
name = "checks";
|
||||
depsOutputHash = "sha256:1s4ldzny9f8vpp96sff8zy2kigz3hi560ikrgyp5630ffrc8affq";
|
||||
depsOutputHash = "sha256:01krrafg5df42z3r7y74g8lx859my4610cqx3a7d02laqq9yjqc6";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gerrit.googlesource.com/plugins/checks";
|
||||
rev = "ab49a63f5c159bda42d9ad1bdb9286bede6c5de4";
|
||||
sha256 = "sha256:0plvgx61pwksfdr4fpclzm9pxrn4pcydk08jp4y60qd3qlydks3j";
|
||||
rev = "990e936b1e050c4fe7ac3e590bdb5cfff0311232";
|
||||
sha256 = "sha256:0cgrwrimsxx0dnqvp0akv5pz17hy743lhkqvsks60fijb34ps54s";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
2
third_party/gerrit_plugins/oauth/default.nix
vendored
2
third_party/gerrit_plugins/oauth/default.nix
vendored
|
@ -4,7 +4,7 @@ let
|
|||
inherit (import ../builder.nix args) buildGerritBazelPlugin;
|
||||
in buildGerritBazelPlugin rec {
|
||||
name = "oauth";
|
||||
depsOutputHash = "sha256:0g0cga9s1bmzvii8nh372kdaxypc1rj0hlyhralwiyh67r4zlv2c";
|
||||
depsOutputHash = "sha256:1zl0gsia9p585dvpyiyb6fiqs3q9dg7qsxnwkn8ncqdnxlg21gl7";
|
||||
src = pkgs.fetchgit {
|
||||
url = "https://gerrit.googlesource.com/plugins/oauth";
|
||||
rev = "4aa7322db5ec221b2419e12a9ec7af5b8c66659c";
|
||||
|
|
Loading…
Reference in a new issue