Merge branch 'stable-3.1'

* stable-3.1:
  Bazel: Update time attribute of file entries in plugin artifact

Change-Id: Ie55d89b06823678dda84a1812ec08ad15e536168
diff --git a/gerrit_plugin.bzl b/gerrit_plugin.bzl
index 9df7560..f61e6ec 100644
--- a/gerrit_plugin.bzl
+++ b/gerrit_plugin.bzl
@@ -57,16 +57,21 @@
 
     # TODO(davido): Remove manual merge of manifest file when this feature
     # request is implemented: https://github.com/bazelbuild/bazel/issues/2009
+    # TODO(davido): Remove manual touch command when this issue is resolved:
+    # https://github.com/bazelbuild/bazel/issues/10789
     genrule2(
         name = name + target_suffix,
         stamp = 1,
         srcs = ["%s__non_stamped_deploy.jar" % name],
         cmd = " && ".join([
+            "TZ=UTC",
+            "export TZ",
             "GEN_VERSION=$$(cat $(location :%s__gen_stamp_info))" % name,
             "cd $$TMP",
             "unzip -q $$ROOT/$<",
             "echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF",
-            "zip -qr $$ROOT/$@ .",
+            "find . -exec touch '{}' ';'",
+            "zip -Xqr $$ROOT/$@ .",
         ]),
         tools = [":%s__gen_stamp_info" % name],
         outs = ["%s%s.jar" % (name, target_suffix)],