Add support for Bazel in Gerrit tree build
Change-Id: I04559a8506df7174a546dad6edd5c7cb25777b69
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..cfd259d
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,28 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+load(
+ "//tools/bzl:plugin.bzl",
+ "gerrit_plugin",
+ "PLUGIN_DEPS",
+ "PLUGIN_TEST_DEPS",
+)
+
+gerrit_plugin(
+ name = "project-group-structure",
+ srcs = glob(["src/main/java/**/*.java"]),
+ resources = glob(["src/main/resources/**/*"]),
+ manifest_entries = [
+ "Gerrit-PluginName: project-group-structure",
+ "Gerrit-Module: com.ericsson.gerrit.plugins.projectgroupstructure.Module",
+ "Implementation-Title: project-group-structure plugin",
+ "Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/project-group-structure",
+ ],
+)
+
+junit_tests(
+ name = "project_group_structure_tests",
+ srcs = glob(["src/test/java/**/*.java"]),
+ tags = ["project-group-structure"],
+ deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [
+ ":project-group-structure__plugin",
+ ],
+)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md
index bedf322..935077b 100644
--- a/src/main/resources/Documentation/build.md
+++ b/src/main/resources/Documentation/build.md
@@ -1,72 +1,34 @@
Build
=====
-This plugin is built with Buck.
+This @PLUGIN@ plugin is built with Bazel.
-Buck
-----
+Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree.
-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.
-
-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
```
-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/@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
```
+
+To execute the tests run:
+
+```
+ bazel test plugins/@PLUGIN@:project_group_structure_tests
+```