Add support for Bazel in Gerrit tree build
Change-Id: I5f8b53f24701e819fa545887269b5cacb022a160
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..accb5f4
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,26 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+ "//tools/bzl:plugin.bzl",
+ "gerrit_plugin",
+ "PLUGIN_DEPS",
+ "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+ name = "quota",
+ srcs = glob(["src/main/java/**/*.java"]),
+ resources = glob(["src/main/resources/**/*"]),
+ manifest_entries = [
+ "Gerrit-PluginName: quota",
+ "Gerrit-Module: com.googlesource.gerrit.plugins.quota.Module",
+ ],
+)
+
+junit_tests(
+ name = "quota_tests",
+ srcs = glob(["src/test/java/**/*.java"]),
+ tags = ["quota"],
+ deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+ ":quota_plugin",
+ ],
+)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index 7dd1927..b7c7061 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,85 +1,37 @@
Build
=====
-This plugin can be built with Buck or Maven.
+This plugin can be built with Bazel or Maven.
-Buck
+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:
+Build the plugin from Gerrit's root directory:
```
- git clone https://gerrit.googlesource.com/bucklets
-
-```
-and link it to quota plugin directory:
-
-```
- cd quota && ln -s ../bucklets .
-```
-
-Add link to the .buckversion file:
-
-```
- cd quota && ln -s bucklets/buckversion .buckversion
-```
-
-Add link to the .watchmanconfig file:
-```
- cd server-config && ln -s bucklets/watchmanconfig .watchmanconfig
-```
-
-To build the plugin, issue the following command:
-
-
-```
- buck build plugin
+ bazel build plugins/quota
```
The output is created in
```
- buck-out/gen/quota.jar
+ bazel-genfiles/plugins/quota/quota.jar
```
-Test are executed with
-
-```
- buck test
-```
-
-### Build in Gerrit tree
-
-Clone or link this plugin to the plugins directory of Gerrit's source
-tree, and issue the command:
-
-```
- buck build plugins/quota
-```
-
-The output is created in
-
-```
- buck-out/gen/plugins/quota/quota.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's
+`tools/bzl/plugins.bzl` and execute:
```
./tools/eclipse/project.py
```
-Test are executed with
+To execute the tests run:
```
- buck test --include quota-plugin
+ bazel test plugins/quota:quota_tests
```
Maven
@@ -92,5 +44,5 @@
To build with Maven, run
```
-mvn clean package
+ mvn clean package
```