From build process perspective there are three types of plugins:
Bazel tree driven
These types can be combined: if both files in plugin’s root directory exist:
the plugin can be built with both Bazel and Maven.
Maven driven build
If plugin contains
pom.xml file, it can be built with Maven as
mvn clean package
Exceptions from the rule above:
pom.xml references snapshot version of plugin API:
2.8-SNAPSHOT. In this case there are two possibilities:
switch to release API. Change plugin API version in
2.8.1and repeat step 1 above.
build and install
SNAPSHOTversion of plugin API in local Maven repository:
pom.xml references other own or foreign (unpublished)
libraries or even other Gerrit plugins. These libraries and/or plugins
must be built and installed in local Maven repository. Clone the related
projects and issue
Repeat step 1. above.
Bazel in tree driven
The fact that plugin contains
BUILD file doesn’t mean that building
this plugin from the plugin directory works.
Bazel in tree driven means it can only be built from within Gerrit tree. Clone or link the plugin into gerrit/plugins directory:
cd gerrit bazel build plugins/<plugin-name>:<plugin-name>
The output can be normally found in the following directory:
Some plugins describe their build process in
src/main/resources/Documentation/build.md file. It may worth checking.
Plugins with external dependencies
If the plugin has external dependencies, then they must be included from
Gerrit’s own WORKSPACE file. This can be achieved by including them in
external_plugin_deps.bzl. During the build in Gerrit tree, this file
must be copied over the dummy one in
Example for content of
load("//tools/bzl:maven_jar.bzl", "maven_jar") def external_plugin_deps(): maven_jar( name = 'org_apache_tika_tika_core', artifact = 'org.apache.tika:tika-core:1.12', sha1 = '5ab95580d22fe1dee79cffbcd98bb509a32da09b', )
Bazel standalone driven
Only few plugins support that mode for now:
cd reviewers bazel build reviewers
Part of Gerrit Code Review