Add support for Bazel in Gerrit tree build

Change-Id: I03a13141b24383f3d002c64ef03ca581ed854ef3
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..f032d8e
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,16 @@
+load("//tools/bzl:plugin.bzl", "gerrit_plugin")
+
+gerrit_plugin(
+    name = "groovy-provider",
+    srcs = glob(["src/main/java/**/*.java"]),
+    resources = glob(["src/main/resources/**/*"]),
+    manifest_entries = [
+        "Implementation-Title: Groovy Provider",
+        "Implementation-URL: https://gerrit.googlesource.com/plugins/scripting/groovy-provider",
+        "Gerrit-PluginName: groovy-provider",
+        "Gerrit-Module: com.googlesource.gerrit.plugins.scripting.groovyprovider.Module",
+    ],
+    deps = [
+        "@groovy//jar",
+    ],
+)
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
new file mode 100644
index 0000000..c2e6049
--- /dev/null
+++ b/external_plugin_deps.bzl
@@ -0,0 +1,8 @@
+load("//tools/bzl:maven_jar.bzl", "maven_jar")
+
+def external_plugin_deps():
+  maven_jar(
+    name = 'groovy',
+    artifact = 'org.codehaus.groovy:groovy-all:2.2.1',
+    sha1 = '07ae565d50d24167c4e5d74b96f4126d4c56f16f',
+  )
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index a7afbc9..a7fa8e0 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,22 +1,36 @@
 Build
 =====
 
-This plugin is built with Buck.
+This plugin is built with Bazel.
 
-Clone or link this plugin to the plugins directory of Gerrit's source
-tree, and issue the command:
+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.
 
 ```
-  buck build plugins/cookbook-plugin
+  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
 
 ```
-  buck-out/gen/plugins/groovy-provider/groovy-provider.jar
+  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
 ```
 
-This project can be imported into the Eclipse IDE:
+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