Consume events-broker directly from source

events-broker is a pure Bazel build since Change 385897 and
can now be directly built and consumed from source instead
of downloading it from Maven central.

Change-Id: Ifd46bf9513e98c5a26932af1665a76e9eb01534e
diff --git a/BUILD b/BUILD
index 34cc807..f9cfcee 100644
--- a/BUILD
+++ b/BUILD
@@ -18,9 +18,9 @@
     ],
     resources = glob(["src/main/resources/**/*"]),
     deps = [
+        ":events-broker-neverlink",
         ":pull-replication-neverlink",
         ":replication-neverlink",
-        "@events-broker//jar:neverlink",
         "@global-refdb//jar:neverlink",
     ],
 )
@@ -37,6 +37,12 @@
     exports = ["//plugins/pull-replication"],
 )
 
+java_library(
+    name = "events-broker-neverlink",
+    neverlink = 1,
+    exports = ["//plugins/events-broker"],
+)
+
 junit_tests(
     name = "multi_site_tests",
     srcs = glob(["src/test/java/**/*.java"]),
@@ -57,7 +63,7 @@
     exports = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
         ":multi-site__plugin",
         "@global-refdb//jar",
-        "@events-broker//jar",
+        "//plugins/events-broker",
         "//plugins/pull-replication",
         "//plugins/replication",
     ],
diff --git a/Jenkinsfile b/Jenkinsfile
index 1d09d53..5b02057 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -1,3 +1,4 @@
 pluginPipeline(formatCheckId: 'gerritforge:multi-site-format-47168e90078b0b3f11401610930e82830e76bff7',
                buildCheckId: 'gerritforge:multi-site-47168e90078b0b3f11401610930e82830e76bff7',
-               extraPlugins: [ 'pull-replication' ])
+               extraPlugins: [ 'pull-replication' ],
+               extraModules: [ 'events-broker' ])
diff --git a/e2e-tests/test.sh b/e2e-tests/test.sh
index 1dd2ed2..c3893a8 100755
--- a/e2e-tests/test.sh
+++ b/e2e-tests/test.sh
@@ -196,7 +196,6 @@
 done
 
 # Defaults
-EVENTS_BROKER_VER=`grep 'com.gerritforge:events-broker' ${LOCATION}/../external_plugin_deps.bzl | cut -d '"' -f 2 | cut -d ':' -f 3`
 GLOBAL_REFDB_VER=`grep 'com.gerritforge:global-refdb' ${LOCATION}/../external_plugin_deps.bzl | cut -d '"' -f 2 | cut -d ':' -f 3`
 DEPLOYMENT_LOCATION=$(mktemp -d || $(echo >&2 "Could not create temp dir" && exit 1))
 MULTISITE_LIB_LOCATION=${MULTISITE_LIB_LOCATION:-${DEF_MULTISITE_LOCATION}}
@@ -266,8 +265,7 @@
   -O $COMMON_LIBS/global-refdb.jar || { echo >&2 "Cannot download global-refdb library: Check internet connection. Aborting"; exit 1; }
 
 echo "Downloading events-broker library $GERRIT_BRANCH"
-wget https://repo1.maven.org/maven2/com/gerritforge/events-broker/$EVENTS_BROKER_VER/events-broker-$EVENTS_BROKER_VER.jar \
-  -O $COMMON_LIBS/events-broker.jar || { echo >&2 "Cannot download events-broker library: Check internet connection. Aborting"; exit 1; }
+cp bazel-bin/plugins/events-broker/events-broker.jar $COMMON_LIBS/events-broker.jar
 
 echo "Setting up directories"
 mkdir -p ${GERRIT_1_ETC} ${GERRIT_1_PLUGINS} ${GERRIT_1_LIBS} ${GERRIT_2_ETC} ${GERRIT_2_PLUGINS} ${GERRIT_2_LIBS}
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 022ba60..476b65c 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -6,9 +6,3 @@
         artifact = "com.gerritforge:global-refdb:3.4.8.6",
         sha1 = "5b8e943f94c64e3164e0d78f1c27795db7f72a4f",
     )
-
-    maven_jar(
-        name = "events-broker",
-        artifact = "com.gerritforge:events-broker:3.4.0.4",
-        sha1 = "8d361d863382290e33828116e65698190118d0f1",
-    )