Merge branch 'stable-3.6' into stable-3.7

* stable-3.6:
  Consume events-broker from source
  Bump up events-broker version to 3.5.1

Change-Id: Ie97237a41a24a21580046cce4cce8164697e1f1d
diff --git a/BUILD b/BUILD
index e9be8bb..e526117 100644
--- a/BUILD
+++ b/BUILD
@@ -18,8 +18,8 @@
     ],
     resources = glob(["src/main/resources/**/*"]),
     deps = [
+        ":events-broker-neverlink",
         "@api-common//jar",
-        "@events-broker//jar:neverlink",
         "@gax-grpc//jar",
         "@gax//jar",
         "@google-auth-library-credentials//jar",
@@ -52,8 +52,8 @@
     tags = ["events-gcloud-pubsub"],
     deps = [
         ":events-gcloud-pubsub__plugin_test_deps",
+        "//plugins/events-broker",
         "@api-common//jar",
-        "@events-broker//jar",
         "@gax-grpc//jar",
         "@gax//jar",
         "@google-auth-library-credentials//jar",
@@ -113,3 +113,9 @@
         "@opencensus-contrib-http-util//jar",
     ],
 )
+
+java_library(
+    name = "events-broker-neverlink",
+    neverlink = 1,
+    exports = ["//plugins/events-broker"],
+)
diff --git a/Jenkinsfile b/Jenkinsfile
index 981c2bb..04f6a4b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,2 +1,3 @@
 pluginPipeline(formatCheckId: 'gerritforge:plugins-events-gcloud-pubsub-code-style',
-                buildCheckId: 'gerritforge:plugins-events-gcloud-pubsub-build-test')
+                buildCheckId: 'gerritforge:plugins-events-gcloud-pubsub-build-test',
+                extraModules: ['events-broker'])
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 760f2aa..29a06a1 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -43,12 +43,6 @@
         sha1 = "11e565f1a65f7e2245238ac5c19875c0ddd25b14",
     )
 
-    maven_jar(
-        name = "events-broker",
-        artifact = "com.gerritforge:events-broker:3.6.0-rc3",
-        sha1 = "cb398afa4f76367be5c62b99a7ffce74ae1d3d8b",
-    )
-
     TESTCONTAINERS_VERSION = "1.15.3"
 
     maven_jar(
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 73f1a9f..729cd9b 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -2,7 +2,8 @@
 
 The events-gcloud-pubsub plugin can be built as a regular 'in-tree' plugin. That means
 that is required to clone a Gerrit source tree first and then to have the plugin
-source directory into the `/plugins` path.
+source directory into the `/plugins` path. The plugin depends on [events-broker](https://gerrit.googlesource.com/modules/events-broker)
+which is linked directly from source with the same 'in-tree' plugin structure.
 
 Additionally, the `plugins/external_plugin_deps.bzl` file needs to be updated to
 match the events-gcloud-pubsub plugin one.
@@ -11,6 +12,7 @@
 git clone --recursive https://gerrit.googlesource.com/gerrit
 cd gerrit
 git clone "https://gerrit.googlesource.com/plugins/events-gcloud-pubsub" plugins/events-gcloud-pubsub
+git clone "https://gerrit.googlesource.com/modules/events-broker" plugins/events-broker
 ln -sf ../plugins/events-gcloud-pubsub/external_plugin_deps.bzl plugins/.
 bazelisk build plugins/events-gcloud-pubsub
 ```