Merge branch 'stable-2.13'

* stable-2.13:
  Add hostname label to Gerrit Metrics in ElasticSearch
  Update ElasticSearch library and its dependencies

Change-Id: Idd7040ca41cb77337c00bad1d61b284f37d8c3a4
diff --git a/BUCK b/BUCK
deleted file mode 100644
index b28e672..0000000
--- a/BUCK
+++ /dev/null
@@ -1,58 +0,0 @@
-include_defs('//bucklets/gerrit_plugin.bucklet')
-include_defs('//lib/maven.defs')
-
-gerrit_plugin(
-  name = 'metrics-reporter-elasticsearch',
-  srcs = glob(['src/main/java/**/*.java']),
-  resources = glob(['src/main/resources/**/*']),
-  deps = [
-    '//lib/dropwizard:dropwizard-core',
-    ':metrics-elasticsearch-reporters',
-    ':jackson-databind',
-    ':jackson-core'
-  ],
-  manifest_entries = [
-    'Gerrit-PluginName: metrics-reporter-elasticsearch',
-  ],
-)
-
-maven_jar(
-  name = 'metrics-elasticsearch-reporters',
-  id = 'org.elasticsearch:metrics-elasticsearch-reporter:2.2.0',
-  sha1 = '85d3e2f0123df56795e5d925ec2c7b4fd2556792',
-  license = 'Apache2.0',
-  deps = [ ':jackson-databind', ':jackson-module-afterburner' ],
-)
-maven_jar(
-  name = 'jackson-databind',
-  id = 'com.fasterxml.jackson.core:jackson-databind:2.6.5',
-  sha1 = 'd50be1723a09befd903887099ff2014ea9020333',
-  deps = [ ':jackson-core', ':jackson-annotations' ],
-  license = 'Apache2.0',
-)
-maven_jar(
-  name = 'jackson-module-afterburner',
-  id = 'com.fasterxml.jackson.module:jackson-module-afterburner:2.6.5',
-  sha1 = 'b0dcd6af98fe599aa98c59bef27cbabbba7bef51',
-  deps = [ ':jackson-core', ':jackson-annotations' ],
-  license = 'Apache2.0',
-)
-maven_jar(
-  name = 'jackson-core',
-  id = 'com.fasterxml.jackson.core:jackson-core:2.6.5',
-  sha1 = '334369d7eff497f358b248c171dac0dd62c68f67',
-  license = 'Apache2.0',
-)
-maven_jar(
-  name = 'jackson-annotations',
-  id = 'com.fasterxml.jackson.core:jackson-annotations:2.6.0',
-  sha1 = 'a0990e2e812ac6639b6ce955c91b13228500476e',
-  license = 'Apache2.0',
-)
-
-# this is required for bucklets/tools/eclipse/project.py to work
-java_library(
-  name = 'classpath',
-  deps = [':metrics-reporter-elasticsearch__plugin'],
-)
-
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..f432553
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,13 @@
+load("//tools/bzl:plugin.bzl", "gerrit_plugin")
+
+gerrit_plugin(
+    name = "metrics-reporter-elasticsearch",
+    srcs = glob(["src/main/java/**/*.java"]),
+    resources = glob(["src/main/resources/**/*"]),
+    manifest_entries = [
+        "Gerrit-PluginName: metrics-reporter-elasticsearch",
+    ],
+    deps = [
+        "@metrics_elasticsearch_reporters//jar",
+    ],
+)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
new file mode 100644
index 0000000..cf084a9
--- /dev/null
+++ b/external_plugin_deps.bzl
@@ -0,0 +1,44 @@
+load("//tools/bzl:maven_jar.bzl", "maven_jar")
+
+def external_plugin_deps():
+  maven_jar(
+    name = 'metrics_elasticsearch_reporters',
+    artifact = 'org.elasticsearch:metrics-elasticsearch-reporter:2.2.0',
+    sha1 = '85d3e2f0123df56795e5d925ec2c7b4fd2556792',
+    deps = [
+      '@jackson_databind//jar',
+      '@jackson_module_afterburner//jar',
+    ],
+  )
+
+  maven_jar(
+    name = 'jackson_databind',
+    artifact = 'com.fasterxml.jackson.core:jackson-databind:2.6.5',
+    sha1 = 'd50be1723a09befd903887099ff2014ea9020333',
+    deps = [
+      '@jackson_core//jar',
+      '@jackson_annotations//jar',
+    ],
+  )
+
+  maven_jar(
+    name = 'jackson_core',
+    artifact = 'com.fasterxml.jackson.core:jackson-core:2.6.5',
+    sha1 = '334369d7eff497f358b248c171dac0dd62c68f67',
+  )
+
+  maven_jar(
+    name = 'jackson_annotations',
+    artifact = 'com.fasterxml.jackson.core:jackson-annotations:2.6.0',
+    sha1 = 'a0990e2e812ac6639b6ce955c91b13228500476e',
+  )
+
+  maven_jar(
+    name = 'jackson_module_afterburner',
+    artifact = 'com.fasterxml.jackson.module:jackson-module-afterburner:2.6.5',
+    sha1 = 'b0dcd6af98fe599aa98c59bef27cbabbba7bef51',
+    deps = [
+      '@jackson_core//jar',
+      '@jackson_annotations//jar',
+    ],
+  )
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
new file mode 100644
index 0000000..ba9f1b5
--- /dev/null
+++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,41 @@
+Build
+=====
+
+This plugin is built with Bazel.
+
+Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree.
+
+Put the external dependency Bazel build file into the Gerrit /plugins directory,
+replacing the existing empty one.
+
+```
+  cd gerrit/plugins
+  rm external_plugin_deps.bzl
+  ln -s @PLUGIN@/external_plugin_deps.bzl .
+```
+
+Then issue
+
+```
+  bazel build plugins/@PLUGIN@
+```
+
+in the root of Gerrit's source tree to build
+
+The output is created in
+
+```
+  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
+```
+
+This project can be imported into the Eclipse IDE.
+Add the plugin name to the `CUSTOM_PLUGINS` set in
+Gerrit core in `tools/bzl/plugins.bzl`, and execute:
+
+```
+  ./tools/eclipse/project.py
+```
+
+[Back to @PLUGIN@ documentation index][index]
+
+[index]: index.html