Merge pull request #6431 from jtattermusch/backport_csharp_proto2_review

Backport review comments for C# proto2 features (for 3.9.x)
diff --git a/BUILD b/BUILD
index 44beeb2..dbae719 100644
--- a/BUILD
+++ b/BUILD
@@ -1,5 +1,9 @@
 # Bazel (https://bazel.build/) BUILD file for Protobuf.
 
+load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library")
+load("@rules_java//java:defs.bzl", "java_library")
+load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
+
 licenses(["notice"])
 
 exports_files(["LICENSE"])
diff --git a/java/pom.xml b/java/pom.xml
index 1fdf953..9b46f8a 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -142,6 +142,9 @@
               <goals>
                 <goal>jar</goal>
               </goals>
+              <configuration>
+                <failOnError>false</failOnError>
+              </configuration>
             </execution>
           </executions>
         </plugin>
@@ -188,13 +191,16 @@
           <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-javadoc-plugin</artifactId>
-            <version>2.9.1</version>
+            <version>2.10.3</version>
             <executions>
               <execution>
                 <id>attach-javadocs</id>
                 <goals>
                   <goal>jar</goal>
                 </goals>
+                <configuration>
+                  <failOnError>false</failOnError>
+                </configuration>
               </execution>
             </executions>
           </plugin>
diff --git a/kokoro/linux/bazel/build.sh b/kokoro/linux/bazel/build.sh
index 6b55ab1..a49e855 100755
--- a/kokoro/linux/bazel/build.sh
+++ b/kokoro/linux/bazel/build.sh
@@ -3,6 +3,10 @@
 # Build file to set up and run tests
 set -ex
 
+# Install the latest Bazel version available
+use_bazel.sh latest
+bazel version
+
 # Change to repo root
 cd $(dirname $0)/../../..
 
diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl
index 25fad72..57509ee 100644
--- a/protobuf_deps.bzl
+++ b/protobuf_deps.bzl
@@ -5,7 +5,7 @@
 def protobuf_deps():
     """Loads common dependencies needed to compile the protobuf library."""
 
-    if "zlib" not in native.existing_rules():
+    if not native.existing_rule("zlib"):
         http_archive(
             name = "zlib",
             build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
@@ -13,3 +13,35 @@
             strip_prefix = "zlib-1.2.11",
             urls = ["https://zlib.net/zlib-1.2.11.tar.gz"],
         )
+
+    if not native.existing_rule("six"):
+        http_archive(
+            name = "six",
+            build_file = "@//:six.BUILD",
+            sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
+            urls = ["https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz#md5=34eed507548117b2ab523ab14b2f8b55"],
+        )
+
+    if not native.existing_rule("rules_cc"):
+        http_archive(
+            name = "rules_cc",
+            sha256 = "29daf0159f0cf552fcff60b49d8bcd4f08f08506d2da6e41b07058ec50cfeaec",
+            strip_prefix = "rules_cc-b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e",
+            urls = ["https://github.com/bazelbuild/rules_cc/archive/b7fe9697c0c76ab2fd431a891dbb9a6a32ed7c3e.tar.gz"],
+        )
+
+    if not native.existing_rule("rules_java"):
+        http_archive(
+            name = "rules_java",
+            sha256 = "f5a3e477e579231fca27bf202bb0e8fbe4fc6339d63b38ccb87c2760b533d1c3",
+            strip_prefix = "rules_java-981f06c3d2bd10225e85209904090eb7b5fb26bd",
+            urls = ["https://github.com/bazelbuild/rules_java/archive/981f06c3d2bd10225e85209904090eb7b5fb26bd.tar.gz"],
+        )
+
+    if not native.existing_rule("rules_proto"):
+        http_archive(
+            name = "rules_proto",
+            sha256 = "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d",
+            strip_prefix = "rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4",
+            urls = ["https://github.com/bazelbuild/rules_proto/archive/b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz"],
+        )