Add support for Bazel in Gerrit tree build

Change-Id: I9d8be0a0da397df14da0285fba2c5c278408548e
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..bf3aa27
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,30 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+    "//tools/bzl:plugin.bzl",
+    "gerrit_plugin",
+    "PLUGIN_DEPS",
+    "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+    name = "websession-flatfile",
+    srcs = glob(["src/main/java/**/*.java"]),
+    resources = glob(["src/main/resources/**/*"]),
+    manifest_entries = [
+        "Gerrit-PluginName: websession-flatfile",
+        "Gerrit-Module: com.googlesource.gerrit.plugins.websession.flatfile.Module",
+        "Gerrit-HttpModule: com.googlesource.gerrit.plugins.websession.flatfile.FlatFileWebSession$Module",
+        "Implementation-Title: Flat file WebSession",
+        "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/websession-flatfile",
+    ],
+)
+
+junit_tests(
+    name = "websession_flatfile_tests",
+    srcs = glob(["src/test/java/**/*.java"]),
+    resources = glob(["src/test/resources/**/*"]),
+    tags = ["websession-flatfile"],
+    deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+        ":websession-flatfile__plugin",
+    ],
+)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 6d99b77..f893189 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,91 +1,27 @@
 Build
 =====
 
-This plugin is built with Buck.
+This @PLUGIN@ plugin is built with Bazel.
 
-Two build modes are supported: Standalone and in Gerrit tree.
-The standalone build mode is recommended, as this mode doesn't require
-the Gerrit tree to exist locally.
+Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree.
 
-#### Build standalone
-
-Clone bucklets library:
+Then issue
 
 ```
-  git clone https://gerrit.googlesource.com/bucklets
-
-```
-and link it to @PLUGIN@ plugin directory:
-
-```
-  cd @PLUGIN@ && ln -s ../bucklets .
+  bazel build plugins/@PLUGIN@
 ```
 
-Add link to the .buckversion file:
-
-```
-  cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion
-```
-
-Add link to the .watchmanconfig file:
-
-```
-  cd @PLUGIN@ && ln -s bucklets/watchmanconfig .watchmanconfig
-```
-
-To build the plugin, issue the following command:
-
-```
-  buck build plugin
-```
+in the root of Gerrit's source tree to build
 
 The output is created in
 
 ```
-  buck-out/gen/@PLUGIN@.jar
+  bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar
 ```
 
-This project can be imported into the Eclipse IDE:
-
-```
-  ./bucklets/tools/eclipse.py
-```
-
-To execute the tests run:
-
-```
-  buck test
-```
-
-To build plugin sources run:
-
-```
-  buck build src
-```
-
-The output is created in:
-
-```
-  buck-out/gen/@PLUGIN@-sources.jar
-```
-
-
-#### Build in Gerrit tree
-
-Clone or link this plugin to the plugins directory of Gerrit's source
-tree. Then, in the root of Gerrit's source tree, issue the following command to build:
-
-```
-  buck build plugins/@PLUGIN@
-```
-
-The output is created in
-
-```
-  buck-out/gen/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
@@ -94,8 +30,8 @@
 To execute the tests run:
 
 ```
-  buck test --include @PLUGIN@
+  bazel test plugins/@PLUGIN@:websession_flatfile_tests
 ```
 
 How to build the Gerrit Plugin API is described in the [Gerrit
-documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).
+documentation](../../../Documentation/dev-bazel.html#_extension_and_plugin_api_jar_files).