From 1fdd3f7b27bf923782252a898cee6e3dd3c2d260 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 8 Jan 2020 17:14:57 +0100 Subject: [PATCH 1/6] lib/lucene: merge jars using a java_binary rule In I42fd1a130e ("Merge Lucene core and backward-codecs jars"), Dave Borowitz introduced a script to concatenate META-INF/services/ files for Codecs. Buck would randomly pick one of the two service files. The solution was to explicitly pick the first entry for class files, and concatenate service files. In Bazel, we can have Bazel do the work of merging jars. This is done with the java_binary rule. This concatenates the service files, and picks a single .class file from each input jar, as determined by the ordering in the jars attribute. Delete tools/merge_jars.py, as this was its only use. This also fixes an issue where Mac users need to specify --host_force_python=PY2 if they don't have Python 3. Change-Id: Ibe62917e20eeb1824967782d4d510f3f63775fce --- lib/lucene/BUILD | 25 ++++++++++++++++------- tools/BUILD | 8 -------- tools/merge_jars.py | 49 --------------------------------------------- 3 files changed, 18 insertions(+), 64 deletions(-) delete mode 100755 tools/merge_jars.py diff --git a/lib/lucene/BUILD b/lib/lucene/BUILD index b8b2457fcc..5ca9580f09 100644 --- a/lib/lucene/BUILD +++ b/lib/lucene/BUILD @@ -1,17 +1,28 @@ -load("@rules_java//java:defs.bzl", "java_library") +load("@rules_java//java:defs.bzl", "java_binary", "java_import", "java_library") load("//tools/bzl:maven.bzl", "merge_maven_jars") package(default_visibility = ["//visibility:public"]) -# core and backward-codecs both provide -# META-INF/services/org.apache.lucene.codecs.Codec, so they must be merged. -merge_maven_jars( - name = "lucene-core-and-backward-codecs", - srcs = [ +# Merge jars so +# META-INF/services/org.apache.lucene.codecs.Codec +# contains the union of both Codec collections. +java_binary( + name = "lucene-core-and-backward-codecs-merged", + data = ["//lib:LICENSE-Apache2.0"], + main_class = "NotImportant", + runtime_deps = [ + # in case of conflict, we want the implementation of backwards-codecs + # first. "@backward-codecs//jar", "@lucene-core//jar", ], - data = ["//lib:LICENSE-Apache2.0"], +) + +java_import( + name = "lucene-core-and-backward-codecs", + jars = [ + ":lucene-core-and-backward-codecs-merged_deploy.jar", + ], ) java_library( diff --git a/tools/BUILD b/tools/BUILD index 708302bea4..961af1e163 100644 --- a/tools/BUILD +++ b/tools/BUILD @@ -4,17 +4,9 @@ load( "default_java_toolchain", ) load("@rules_java//java:defs.bzl", "java_package_configuration") -load("@rules_python//python:defs.bzl", "py_binary") exports_files(["nongoogle.bzl"]) -py_binary( - name = "merge_jars", - srcs = ["merge_jars.py"], - main = "merge_jars.py", - visibility = ["//visibility:public"], -) - default_java_toolchain( name = "error_prone_warnings_toolchain", bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath.jar"], diff --git a/tools/merge_jars.py b/tools/merge_jars.py deleted file mode 100755 index 6b46069e65..0000000000 --- a/tools/merge_jars.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2015 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. - -from __future__ import print_function -import collections -import sys -import zipfile - -if len(sys.argv) < 3: - print('usage: %s ...' % sys.argv[0], file=sys.stderr) - exit(1) - -outfile = sys.argv[1] -infiles = sys.argv[2:] -seen = set() -SERVICES = 'META-INF/services/' - -try: - with zipfile.ZipFile(outfile, 'w') as outzip: - services = collections.defaultdict(lambda: '') - for infile in infiles: - with zipfile.ZipFile(infile) as inzip: - for info in inzip.infolist(): - n = info.filename - if n in seen: - continue - elif n.startswith(SERVICES): - # Concatenate all provider configuration files. - services[n] += inzip.read(n).decode("UTF-8") - continue - outzip.writestr(info, inzip.read(n)) - seen.add(n) - - for n, v in list(services.items()): - outzip.writestr(n, v) -except Exception as err: - exit('Failed to merge jars: %s' % err) From 841e3927dd86cefed7ecc122381655e1772653d3 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Thu, 9 Jan 2020 01:05:05 +0100 Subject: [PATCH 2/6] Document that gerrit supports JDK 11 Change-Id: I430a2022764e526bea70d97f5a06419f2d968f8d --- Documentation/install.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/install.txt b/Documentation/install.txt index b6a295449d..2f004922f0 100644 --- a/Documentation/install.txt +++ b/Documentation/install.txt @@ -5,9 +5,9 @@ To run the Gerrit service, the following requirement must be met on the host: -* JRE, version 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download] +* JRE, versions 1.8 or 11 http://www.oracle.com/technetwork/java/javase/downloads/index.html[Download] + -Gerrit is not yet compatible with Java 9 or newer at this time. +Gerrit is not yet compatible with Java 13 or newer at this time. By default, Gerrit uses link:note-db.html[NoteDB] as the storage backend. (If desired, you can _optionally_ use an external database such as MySQL or From 44933877154811001ffb6dbef28f260d0e09bac8 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Thu, 9 Jan 2020 08:00:48 +0100 Subject: [PATCH 3/6] Bazel: Fix issues flagged by buildifier Use the -lint=fix option to automatically format files. buildifier version: 0.29.0 buildifier scm revision: 19db42aa7a206a52b67bc66477c069ca83d092f4 Change-Id: I50a31fe96d3acd49b2674df8ce5a8c9c3ec455e1 --- BUILD | 4 ++-- polygerrit-ui/app/rules.bzl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BUILD b/BUILD index 907441efdd..10162beddd 100644 --- a/BUILD +++ b/BUILD @@ -1,8 +1,8 @@ -package(default_visibility = ["//visibility:public"]) - load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:pkg_war.bzl", "pkg_war") +package(default_visibility = ["//visibility:public"]) + config_setting( name = "java9", values = { diff --git a/polygerrit-ui/app/rules.bzl b/polygerrit-ui/app/rules.bzl index 075e34a39d..98387a02c8 100644 --- a/polygerrit-ui/app/rules.bzl +++ b/polygerrit-ui/app/rules.bzl @@ -104,7 +104,7 @@ def polygerrit_bundle(name, srcs, outs, app): "for f in $(locations " + name + "_theme_sources); do cp $$f $$TMP/polygerrit_ui/styles/themes; done", "for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done", "unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js", - "unzip -qd $$TMP/polygerrit_ui/bower_components $(location @font-roboto-local//:zipfile) font-roboto-local/fonts/\*/\*.ttf", + "unzip -qd $$TMP/polygerrit_ui/bower_components $(location @font-roboto-local//:zipfile) font-roboto-local/fonts/\\*/\\*.ttf", "cd $$TMP", "find . -exec touch -t 198001010000 '{}' ';'", "zip -qr $$ROOT/$@ *", From 54d667b7e63ff9d3c9a32365429e75783b06d054 Mon Sep 17 00:00:00 2001 From: Ben Rohlfs Date: Thu, 9 Jan 2020 11:11:01 +0100 Subject: [PATCH 4/6] Fix the size of the commit message box It would only show 70 chars. The commit-message-max-width variable is unused since change 113890, so let's remove it. The css rule for larger screens did not have any effect, because the commit message element would need a flex-grow > 0 for that. I think with what I have in mind for the future of the change page layout it is good to keep the width fixed at 72 chars all the time. Change-Id: I1aabe3566b9e191317f8d2ee8889fda3d8f986f7 (cherry picked from commit 86ebd20800035424ec7a2afc38d36769edf4724b) --- .../elements/change/gr-change-view/gr-change-view.html | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html index 45df471402..b3280a6be4 100644 --- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html +++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.html @@ -130,7 +130,8 @@ limitations under the License. line-height: var(--line-height-mono); margin-right: var(--spacing-l); margin-bottom: var(--spacing-l); - max-width: var(--commit-message-max-width, 72ch);; + /* Account for border and padding */ + max-width: calc(72ch + 2px + 2*var(--spacing-m)); } .commitMessage gr-linked-text { word-break: break-word; @@ -253,11 +254,6 @@ limitations under the License. #uploadHelpOverlay { width: 50em; } - @media screen and (min-width: 80em) { - .commitMessage { - max-width: var(--commit-message-max-width, 100ch); - } - } #metadata { --metadata-horizontal-padding: var(--spacing-l); padding-top: var(--spacing-l); From 97b7e64f9308b6188466aac1cecadbfebc122a0b Mon Sep 17 00:00:00 2001 From: Paladox none Date: Sun, 29 Dec 2019 21:54:12 +0000 Subject: [PATCH 5/6] Add "Page ..." next to back and forward arrows Tells the user which page they are on. This is already done on the change list. Bug: Issue 12108 Change-Id: Ic565cc76cc977955b71c12b9753b72c425b9f126 (cherry picked from commit e7cb81951d14c0bd763c1dbb6c38e587bfc7c61b) --- .../app/elements/shared/gr-list-view/gr-list-view.html | 1 + .../app/elements/shared/gr-list-view/gr-list-view.js | 7 +++++++ .../elements/shared/gr-list-view/gr-list-view_test.html | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view.html b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view.html index a707e35470..3d41a7c51d 100644 --- a/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view.html +++ b/polygerrit-ui/app/elements/shared/gr-list-view/gr-list-view.html @@ -89,6 +89,7 @@ limitations under the License.