diff --git a/.bazelversion b/.bazelversion index 26aaba0e86..227cea2156 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -1.2.0 +2.0.0 diff --git a/Jenkinsfile b/Jenkinsfile index 988f839533..cb083b46b0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,15 +53,11 @@ class Builds { 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 hasChangeNumber() { } 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 @@ node ('master') { 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 @@ node ('master') { 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 41f2ec7493..2cb6242f41 100644 --- a/polygerrit-ui/README.md +++ b/polygerrit-ui/README.md @@ -51,7 +51,13 @@ simply execute: npm run start ``` -Then visit . +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 55b2495403..e0c1f92d3e 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 @@ limitations under the License. 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 @@ limitations under the License. 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 @@ limitations under the License. }, }; - 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 @@ limitations under the License. }, }; - 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 db1bd3089d..558f004374 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 3c402d1bf2..77c4791372 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 @@ limitations under the License. '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 94519b0af6..6ab13d82fb 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 @@ -236,8 +236,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 5bec680890..f1277ab721 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 0b46d75229..bfccfe9b02 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} chunks * @param {boolean} isBinary + * * @return {!Promise>} 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 30adcc81b3..cae3a91869 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 aedd658455..30deecf251 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 711015ec91..fa44a479ce 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 6b97cf60bb..ffcdba9846 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));