Merge "Merge branch 'stable-3.1'"
diff --git a/.bazelversion b/.bazelversion
index 26aaba0..227cea2 100644
--- a/.bazelversion
+++ b/.bazelversion
@@ -1 +1 @@
-1.2.0
+2.0.0
diff --git a/Jenkinsfile b/Jenkinsfile
index 988f839..cb083b4 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -53,15 +53,11 @@
 
 class GerritCheck {
     String uuid
-    String changeNum
-    String sha1
     Build build
 
-    GerritCheck(name, changeNum, sha1, build) {
+    GerritCheck(name, build) {
         this.uuid = "gerritforge:" + name.replaceAll("(bazel/)", "") +
             Globals.gerritRepositoryNameSha1Suffix
-        this.changeNum = changeNum
-        this.sha1 = sha1
         this.build = build
     }
 
@@ -93,21 +89,7 @@
 }
 
 def postCheck(check) {
-    def gerritPostUrl = Globals.gerritUrl +
-        "a/changes/${check.changeNum}/revisions/${check.sha1}/checks"
-
-    try {
-        def json = check.createCheckPayload()
-        httpRequest(httpMode: 'POST', authentication: Globals.gerritCredentialsId,
-            contentType: 'APPLICATION_JSON', requestBody: json,
-            validResponseCodes: '200', url: gerritPostUrl)
-        echo "----------------------------------------------------------------------------"
-        echo "Gerrit Check: ${check.uuid}=" + check.build.result + " to change " +
-            check.changeNum + "/" + check.sha1
-        echo "----------------------------------------------------------------------------"
-    } catch(Exception e) {
-        echo "ERROR> Failed to post check results to Gerrit: ${e}"
-    }
+    gerritCheck(checks: [ "${check.uuid}" : "${check.getCheckResultFromBuild()}" ])
 }
 
 def queryChangedFiles(url, changeNum, sha1) {
@@ -313,7 +295,7 @@
             gerritReview(
                 labels: ['Code-Style': resCodeStyle],
                 message: createCodeStyleMsgBody(Builds.codeStyle, resCodeStyle))
-            postCheck(new GerritCheck("codestyle", Change.number, Change.sha1, Builds.codeStyle))
+            postCheck(new GerritCheck("codestyle", Builds.codeStyle))
 
             def verificationResults = Builds.verification.collect { k, v -> v }
             def resVerify = verificationResults.inject(1) {
@@ -324,7 +306,7 @@
                 message: createVerifyMsgBody(Builds.verification))
 
             Builds.verification.each { type, build -> postCheck(
-                new GerritCheck(type, Change.number, Change.sha1, build)
+                new GerritCheck(type, build)
             )}
 
             setResult(resVerify, resCodeStyle)
diff --git a/polygerrit-ui/README.md b/polygerrit-ui/README.md
index 41f2ec7..2cb6242 100644
--- a/polygerrit-ui/README.md
+++ b/polygerrit-ui/README.md
@@ -51,7 +51,13 @@
 npm run start
 ```
 
-Then visit <http://localhost:8081>.
+Then visit http://localhost:8081
+
+## Local UI, Test Data
+
+```sh
+./polygerrit-ui/run-server.sh --plugins=plugins/my_plugin/static/my_plugin.js,plugins/my_plugin/static/my_plugin.html
+```
 
 This method is based on a
 [simple hand-written Go webserver](https://gerrit.googlesource.com/gerrit/+/master/polygerrit-ui/server.go).
diff --git a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
index 55b2495..e0c1f92d 100644
--- a/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
+++ b/polygerrit-ui/app/elements/admin/gr-access-section/gr-access-section_test.html
@@ -205,10 +205,9 @@
           id: 'administrateServer',
           value: {},
         };
-        assert.equal(
-            element._computePermissionName(name, permission,
-                element.permissionValues, element.capabilities),
-            element.capabilities[permission.id].name);
+        assert.equal(element._computePermissionName(name, permission,
+            element.permissionValues, element.capabilities),
+        element.capabilities[permission.id].name);
 
         name = 'refs/for/*';
         permission = {
@@ -216,10 +215,9 @@
           value: {},
         };
 
-        assert.equal(
-            element._computePermissionName(
-                name, permission, element.permissionValues, element.capabilities),
-            element.permissionValues[permission.id].name);
+        assert.equal(element._computePermissionName(
+            name, permission, element.permissionValues, element.capabilities),
+        element.permissionValues[permission.id].name);
 
         name = 'refs/for/*';
         permission = {
@@ -229,10 +227,9 @@
           },
         };
 
-        assert.equal(
-            element._computePermissionName(name, permission,
-                element.permissionValues, element.capabilities),
-            'Label Code-Review');
+        assert.equal(element._computePermissionName(name, permission,
+            element.permissionValues, element.capabilities),
+        'Label Code-Review');
 
         permission = {
           id: 'labelAs-Code-Review',
@@ -241,10 +238,9 @@
           },
         };
 
-        assert.equal(
-            element._computePermissionName(name, permission,
-                element.permissionValues, element.capabilities),
-            'Label Code-Review(On Behalf Of)');
+        assert.equal(element._computePermissionName(name, permission,
+            element.permissionValues, element.capabilities),
+        'Label Code-Review(On Behalf Of)');
       });
 
       test('_computeSectionName', () => {
diff --git a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
index db1bd30..558f004 100644
--- a/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
+++ b/polygerrit-ui/app/elements/admin/gr-repo-commands/gr-repo-commands.js
@@ -110,8 +110,7 @@
         const message = change ?
           CREATE_CHANGE_SUCCEEDED_MESSAGE :
           CREATE_CHANGE_FAILED_MESSAGE;
-        this.dispatchEvent(new CustomEvent(
-            'show-alert',
+        this.dispatchEvent(new CustomEvent('show-alert',
             {detail: {message}, bubbles: true, composed: true}));
         if (!change) { return; }
 
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html
index 3c402d1..77c4791 100644
--- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html
+++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_test.html
@@ -57,10 +57,9 @@
           'cell label u-gray-background');
       assert.equal(element._computeLabelClass(
           {labels: {}}, 'Verified'), 'cell label u-gray-background');
-      assert.equal(
-          element._computeLabelClass(
-              {labels: {Verified: {approved: true, value: 1}}}, 'Verified'),
-          'cell label u-green u-monospace');
+      assert.equal(element._computeLabelClass(
+          {labels: {Verified: {approved: true, value: 1}}}, 'Verified'),
+      'cell label u-green u-monospace');
       assert.equal(element._computeLabelClass(
           {labels: {Verified: {rejected: true, value: -1}}}, 'Verified'),
       'cell label u-monospace u-red');
diff --git a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
index 2eab284..1dca9d1 100644
--- a/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
+++ b/polygerrit-ui/app/elements/change/gr-change-metadata/gr-change-metadata.js
@@ -243,8 +243,9 @@
           this.change._number, {add: [newHashtag]}).then(newHashtag => {
         this.set(['change', 'hashtags'], newHashtag);
         if (newHashtag !== lastHashtag) {
-          this.dispatchEvent(new CustomEvent(
-              'hashtag-changed', {bubbles: true, composed: true}));
+          this.dispatchEvent(
+              new CustomEvent('hashtag-changed', {
+                bubbles: true, composed: true}));
         }
       });
     }
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
index 5bec680..f1277ab 100644
--- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
+++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
@@ -1197,6 +1197,7 @@
      * Compute size bar layout values from the file list.
      *
      * @return {Gerrit.LayoutStats|undefined}
+     *
      */
     _computeSizeBarLayout(shownFilesRecord) {
       if (!shownFilesRecord || !shownFilesRecord.base) { return undefined; }
@@ -1280,6 +1281,7 @@
      * Get the x-offset of the deletion bar for a file.
      *
      * @param {Gerrit.LayoutStats} stats
+     *
      * @return {number}
      */
     _computeBarDeletionX(stats) {
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js
index 0b46d75..bfccfe9 100644
--- a/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js
+++ b/polygerrit-ui/app/elements/diff/gr-diff-processor/gr-diff-processor.js
@@ -143,6 +143,7 @@
      *
      * @param {!Array<!Gerrit.DiffChunk>} chunks
      * @param {boolean} isBinary
+     *
      * @return {!Promise<!Array<!Object>>} A promise that resolves with an
      *     array of GrDiffGroups when the diff is completely processed.
      */
diff --git a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js
index 30adcc8..cae3a91 100644
--- a/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js
+++ b/polygerrit-ui/app/elements/plugins/gr-plugin-host/gr-plugin-host.js
@@ -36,7 +36,6 @@
       const htmlPlugins = (plugins.html_resource_paths || []);
       const jsPlugins =
           this._handleMigrations(plugins.js_resource_paths || [], htmlPlugins);
-
       const shouldLoadTheme = config.default_theme &&
             !Gerrit._isPluginPreloaded('preloaded:gerrit-theme');
       const themeToLoad =
diff --git a/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js b/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js
index aedd658..30deecf 100644
--- a/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js
+++ b/polygerrit-ui/app/elements/plugins/gr-styles-api/gr-styles-api.js
@@ -38,8 +38,8 @@
    * @return {string} Appropriate class name for the element is returned
    */
   GrStyleObject.prototype.getClassName = function(element) {
-    let rootNode = Polymer.Settings.useShadow ?
-      element.getRootNode() : document.body;
+    let rootNode = Polymer.Settings.useShadow
+      ? element.getRootNode() : document.body;
     if (rootNode === document) {
       rootNode = document.head;
     }
diff --git a/polygerrit-ui/app/samples/coverage-plugin.html b/polygerrit-ui/app/samples/coverage-plugin.html
index 711015e..fa44a47 100644
--- a/polygerrit-ui/app/samples/coverage-plugin.html
+++ b/polygerrit-ui/app/samples/coverage-plugin.html
@@ -45,9 +45,9 @@
         const line = context.line;
         // Highlight lines missing coverage with this background color if
         // coverage should be displayed, else do nothing.
-        const annotationStyle = displayCoverage ?
-          coverageStyle :
-          emptyStyle;
+        const annotationStyle = displayCoverage
+          ? coverageStyle
+          : emptyStyle;
         if (coverageData[path] &&
               coverageData[path].changeNum === context.changeNum &&
               coverageData[path].patchNum === context.patchNum) {
diff --git a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js
index 6b97cf6..ffcdba9 100644
--- a/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js
+++ b/polygerrit-ui/app/scripts/gr-reviewer-suggestions-provider/gr-reviewer-suggestions-provider.js
@@ -35,8 +35,8 @@
       switch (usersType) {
         case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.REVIEWER:
           return new GrReviewerSuggestionsProvider(restApi, changeNumber,
-              input =>
-                restApi.getChangeSuggestedReviewers(changeNumber, input));
+              input => restApi.getChangeSuggestedReviewers(changeNumber,
+                  input));
         case Gerrit.SUGGESTIONS_PROVIDERS_USERS_TYPES.CC:
           return new GrReviewerSuggestionsProvider(restApi, changeNumber,
               input => restApi.getChangeSuggestedCCs(changeNumber, input));