Bazel: Add :api rule to build all API artifacts at once

This simplifies house keeping for the CI implementations and this was
always supported in Buck driven build. Wenn new API is added, only one
rule needs to be updated, and all CI implementation would reflect
building of new API without any changes on their side.

Change-Id: I050cef1e1545431d8806bd3a15a267842e3ed809
This commit is contained in:
David Ostrovsky 2016-12-24 09:29:33 +01:00
parent 19e0ffffa5
commit 26f8da8f4d
2 changed files with 32 additions and 6 deletions

28
BUILD
View File

@ -1,5 +1,6 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:pkg_war.bzl", "pkg_war")
genrule(
@ -42,3 +43,30 @@ pkg_war(
name = "withdocs",
doc = True,
)
API_DEPS = [
"//gerrit-acceptance-framework:acceptance-framework_deploy.jar",
"//gerrit-acceptance-framework:liblib-src.jar",
"//gerrit-acceptance-framework:acceptance-framework-javadoc",
"//gerrit-extension-api:extension-api_deploy.jar",
"//gerrit-extension-api:libapi-src.jar",
"//gerrit-extension-api:extension-api-javadoc",
"//gerrit-plugin-api:plugin-api_deploy.jar",
"//gerrit-plugin-api:plugin-api-sources_deploy.jar",
"//gerrit-plugin-api:plugin-api-javadoc",
"//gerrit-plugin-gwtui:gwtui-api_deploy.jar",
"//gerrit-plugin-gwtui:gwtui-api-source_deploy.jar",
"//gerrit-plugin-gwtui:gwtui-api-javadoc",
]
genrule2(
name = 'api',
srcs = API_DEPS,
testonly = 1,
cmd = ' && '.join([
'cp $(SRCS) $$TMP',
'cd $$TMP',
'zip -qr $$ROOT/$@ .',
]),
outs = ['api.zip'],
)

View File

@ -74,16 +74,14 @@ The output executable WAR will be placed in:
To build the extension, plugin and GWT API JAR files:
----
bazel build gerrit-plugin-api:plugin-api_deploy.jar
bazel build gerrit-extension-api:extension-api_deploy.jar
bazel build api
----
Java binaries, Java sources and Java docs are generated into corresponding
project directories, here as example for plugin API:
The output archive that contains Java binaries, Java sources and
Java docs will be placed in:
----
bazel-bin/gerrit-plugin-api/plugin-api_deploy.jar
bazel-bin/gerrit-extension-api/extension-api_deploy.jar
bazel-genfiles/api.zip
----
Install {extension,plugin,gwt}-api to the local maven repository: