Add support for Bazel in Gerrit tree build Change-Id: I5476882afea0499d3b767e458e9cb89f425c0279
diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..5565e59 --- /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 = "server-config", + srcs = glob(["src/main/java/**/*.java"]), + resources = glob(["src/main/resources/**/*"]), + manifest_entries = [ + "Gerrit-PluginName: server-config", + "Gerrit-HttpModule: com.googlesource.gerrit.plugins.serverconfig.HttpModule", + ], +) + +junit_tests( + name = "server_config_tests", + srcs = glob(["src/test/java/**/*.java"]), + tags = ["server-config"], + deps = PLUGIN_DEPS + PLUGIN_TEST_DEPS + [ + ":server-config__plugin", + ], +) \ No newline at end of file
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md index e58c2b5..991f520 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -3,85 +3,34 @@ This plugin can be built with Buck or Maven. -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 in-tree build mode is recommended if this plugin shall be -build together with the Gerrit tree. -The standalone build mode can be use to build this plugin -independently of the Gerrit tree. - -### Build standalone - -Clone bucklets library: +Then issue ``` - git clone https://gerrit.googlesource.com/bucklets - -``` -and link it to server-config plugin directory: - -``` - cd server-config && ln -s ../bucklets . + bazel build plugins/@PLUGIN@ ``` -Add link to the .buckversion file: - -``` - cd server-config && 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 -``` +in the root of Gerrit's source tree to build The output is created in ``` - buck-out/gen/server-config.jar + bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.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/server-config -``` - -The output is created in - -``` - buck-out/gen/plugins/server-config/server-config.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 ``` -Test are executed with +To execute the tests run: ``` - buck test --include server-config-plugin + bazel test plugins/@PLUGIN@ ``` Maven