From a1d98360a114074494fab8d92f29d635a6c6aa13 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Thu, 21 Mar 2019 23:19:54 +0100 Subject: [PATCH 1/4] Update rules_closure to latest version This updates rules_closure to the version with Protobuf 3.7.1. The new Protobuf version introduced dependency on zlib, that we also have to add as transitive dependency. Change-Id: Ic8fa455e86ed12dc3b7fe71ec2ba32ec00b043cd --- WORKSPACE | 20 ++++++++++++++--- lib/zlib/BUILD | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 lib/zlib/BUILD diff --git a/WORKSPACE b/WORKSPACE index 6aff0357f5..3db020e69a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -14,9 +14,23 @@ http_archive( http_archive( name = "io_bazel_rules_closure", - sha256 = "ddce3b3a3909f99b28b25071c40b7fec7e2e1d1d1a4b2e933f3082aa99517105", - strip_prefix = "rules_closure-316e6133888bfc39fb860a4f1a31cfcbae485aef", - urls = ["https://github.com/bazelbuild/rules_closure/archive/316e6133888bfc39fb860a4f1a31cfcbae485aef.tar.gz"], + sha256 = "34abd9170fdbfdfc6f3b63f2c18cee3cbcb2ddbd5e3c97324add0aa7809ed875", + strip_prefix = "rules_closure-9d543facf886631e4ed379996e60ce3533188adc", + urls = ["https://github.com/bazelbuild/rules_closure/archive/9d543facf886631e4ed379996e60ce3533188adc.tar.gz"], +) + +# Transitive dependency of rules_closure and protobuf +http_archive( + name = "net_zlib", + build_file = "//:lib/zlib/BUILD", + sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", + strip_prefix = "zlib-1.2.11", + urls = ["https://zlib.net/zlib-1.2.11.tar.gz"], +) + +bind( + name = "zlib", + actual = "@net_zlib//:zlib", ) # File is specific to Polymer and copied from the Closure Github -- should be diff --git a/lib/zlib/BUILD b/lib/zlib/BUILD new file mode 100644 index 0000000000..f948117417 --- /dev/null +++ b/lib/zlib/BUILD @@ -0,0 +1,60 @@ +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # BSD/MIT-like license (for zlib) + +_ZLIB_HEADERS = [ + "crc32.h", + "deflate.h", + "gzguts.h", + "inffast.h", + "inffixed.h", + "inflate.h", + "inftrees.h", + "trees.h", + "zconf.h", + "zlib.h", + "zutil.h", +] + +_ZLIB_PREFIXED_HEADERS = ["zlib/include/" + hdr for hdr in _ZLIB_HEADERS] + +# In order to limit the damage from the `includes` propagation +# via `:zlib`, copy the public headers to a subdirectory and +# expose those. +genrule( + name = "copy_public_headers", + srcs = _ZLIB_HEADERS, + outs = _ZLIB_PREFIXED_HEADERS, + cmd = "cp $(SRCS) $(@D)/zlib/include/", + visibility = ["//visibility:private"], +) + +cc_library( + name = "zlib", + srcs = [ + "adler32.c", + "compress.c", + "crc32.c", + "deflate.c", + "gzclose.c", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inflate.c", + "inftrees.c", + "trees.c", + "uncompr.c", + "zutil.c", + # Include the un-prefixed headers in srcs to work + # around the fact that zlib isn't consistent in its + # choice of <> or "" delimiter when including itself. + ] + _ZLIB_HEADERS, + hdrs = _ZLIB_PREFIXED_HEADERS, + copts = [ + "-Wno-unused-variable", + "-Wno-implicit-function-declaration", + ], + includes = ["zlib/include/"], +) From 62bed51f12bd61d7289e83e4aa5d201f22f002fb Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sat, 23 Jun 2018 08:24:40 +0200 Subject: [PATCH 2/4] Bazel: Avoid using tools in action inputs Recent bazel version added an option to ensure, that tools are not used in input, but instead passed as new parameter tools: [1]. Test Plan: $ bazel build --incompatible_no_support_tools_in_action_inputs //... [1] https://docs.bazel.build/versions/master/skylark/backward-compatibility.html#disallow-tools-in-action-inputs Change-Id: I744ae1b28adac7d10037b445761c9dca771738bc (cherry picked from commit 6af7e76bb26c6f5c64bfc02a5707a7f4478b33e7) --- tools/bzl/asciidoc.bzl | 3 ++- tools/bzl/gwt.bzl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/bzl/asciidoc.bzl b/tools/bzl/asciidoc.bzl index 42b3d9ae76..ca7b51e4f4 100644 --- a/tools/bzl/asciidoc.bzl +++ b/tools/bzl/asciidoc.bzl @@ -222,7 +222,8 @@ def _asciidoc_html_zip_impl(ctx): ] args.extend(_generate_asciidoc_args(ctx)) ctx.actions.run( - inputs = ctx.files.srcs + [ctx.executable._exe, ctx.file.version], + inputs = ctx.files.srcs + [ctx.file.version], + tools = [ctx.executable._exe], outputs = [ctx.outputs.out], executable = ctx.executable._exe, arguments = args, diff --git a/tools/bzl/gwt.bzl b/tools/bzl/gwt.bzl index 467e949a6a..3ee106ac8a 100644 --- a/tools/bzl/gwt.bzl +++ b/tools/bzl/gwt.bzl @@ -192,8 +192,9 @@ def _gwt_binary_impl(ctx): ]) ctx.actions.run_shell( - inputs = list(deps) + ctx.files._jdk + ctx.files._zip + gwt_user_agent_modules, + inputs = list(deps) + gwt_user_agent_modules, outputs = [output_zip], + tools = ctx.files._jdk + ctx.files._zip, mnemonic = "GwtBinary", progress_message = "GWT compiling " + output_zip.short_path, command = "set -e\n" + cmd, From 4f33cb7eba786e117176e8d531877e65f5f997ec Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Fri, 5 Apr 2019 14:11:24 -0400 Subject: [PATCH 3/4] ElasticContainer: Use version 7.0.0-rc2 for V7_0 tests Change-Id: I49cd907d56394e2043b6df27530bc131e4fd1340 --- .../java/com/google/gerrit/elasticsearch/ElasticContainer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java b/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java index 794a381bb0..c733de4fec 100644 --- a/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java +++ b/gerrit-elasticsearch/src/test/java/com/google/gerrit/elasticsearch/ElasticContainer.java @@ -51,7 +51,7 @@ public class ElasticContainer extends ElasticsearchContainer { case V6_7: return "docker.elastic.co/elasticsearch/elasticsearch-oss:6.7.0"; case V7_0: - return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-rc1"; + return "docker.elastic.co/elasticsearch/elasticsearch-oss:7.0.0-rc2"; } throw new IllegalStateException("No tests for version: " + version.name()); } From 61d71ddfc41ad5e22ce2f0ad82426d6b52f02003 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sun, 7 Apr 2019 09:39:27 -0700 Subject: [PATCH 4/4] PolyGerrit: Suppress JSC_REFERENCE_BEFORE_DECLARE error Recent closure compiler upgrade broke PolyGerrit's polymer-resin integration: [1]. Suppress the error for now to unblock rules_closure upgrade and remove the suppression later, when the error is fixed upstream. [1] https://github.com/Polymer/polymer-resin/issues/7 Change-Id: I4615d2e5651c67a1aa9beafb45e04cd2e2ea1ee5 --- polygerrit-ui/app/rules.bzl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/polygerrit-ui/app/rules.bzl b/polygerrit-ui/app/rules.bzl index f836cf5c49..d03f9641c7 100644 --- a/polygerrit-ui/app/rules.bzl +++ b/polygerrit-ui/app/rules.bzl @@ -22,6 +22,8 @@ def polygerrit_bundle(name, srcs, outs, app): deps = [name + "_closure_lib"], ) + # TODO(davido): Remove JSC_REFERENCE_BEFORE_DECLARE when this is fixed upstream: + # https://github.com/Polymer/polymer-resin/issues/7 closure_js_library( name = name + "_closure_lib", srcs = [appName + ".js"], @@ -30,6 +32,7 @@ def polygerrit_bundle(name, srcs, outs, app): # and remove this supression suppress = [ "JSC_JSDOC_MISSING_TYPE_WARNING", + "JSC_REFERENCE_BEFORE_DECLARE", "JSC_UNNECESSARY_ESCAPE", "JSC_UNUSED_LOCAL_ASSIGNMENT", ],