Allow plugins to contribute external workspace deps

When building a Gerrit plugin in-tree, allow to add extra dependencies
to the WORKSPACE file.

The only operation required will be the overwrite of the
plugins/external_plugin_deps.bzl file with the one provided by the
plugin.

Bug: Issue 5305
Change-Id: I07e4538f9f81ef923a4ca1aeceaee75d8429434e
This commit is contained in:
Luca Milanesio 2017-01-26 14:24:53 +00:00
parent 7ef2dc02e6
commit 6b19214ef6
3 changed files with 28 additions and 3 deletions

View File

@ -56,9 +56,10 @@ Repeat step 1. above.
The fact that plugin contains `BUILD` file doesn't mean that building this
plugin from the plugin directory works. For now it doesn't. Bazel in tree driven
means it can only be built from within Gerrit tree. Clone or link the plugin
into gerrit/plugins directory:
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
@ -74,6 +75,26 @@ bazel-genfiles/plugins/<plugin-name>/<plugin-name>.jar
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
`plugins` directory.
Example for content of `external_plugin_deps.bzl` file:
----
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:

View File

@ -2,6 +2,7 @@ workspace(name = "gerrit")
load("//tools/bzl:maven_jar.bzl", "maven_jar", "GERRIT", "MAVEN_LOCAL")
load("//lib/codemirror:cm.bzl", "CM_VERSION", "DIFF_MATCH_PATCH_VERSION")
load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
ANTLR_VERS = "3.5.2"
@ -1104,3 +1105,4 @@ bower_archive(
load("//lib/js:bower_archives.bzl", "load_bower_archives")
load_bower_archives()
external_plugin_deps()

View File

@ -0,0 +1,2 @@
def external_plugin_deps():
pass