Buck: Fix building GWT plugins

As explained in [1], [2] in tree build mode is currently broken for
plugins that expose GWT modules.

To rectify, isolate the libraries that used for building regular and
GWT modules. While regular modules need the whole Plugin API as their
dependency, GWT modules should only consume pre-defined set of GWT
API modules.

[1] https://github.com/facebook/buck/issues/109
[2] https://gerrit-review.googlesource.com/63489

Change-Id: I4694745254ec0f2d9578d79b62110241d4b8b429
This commit is contained in:
David Ostrovsky 2015-01-23 21:50:47 +01:00
parent 5dea1c0fc0
commit 19267674f7

View File

@ -127,20 +127,29 @@ def gerrit_plugin(
srcs = mf_src,
out = 'MANIFEST.MF',
)
gwt_deps = []
static_jars = []
if gwt_module:
gwt_deps = GWT_PLUGIN_DEPS
static_jars = [':%s-static-jar' % name]
java_library(
name = name + '__plugin',
srcs = srcs,
resources = resources,
deps = deps,
provided_deps = ['//gerrit-%s-api:lib' % type] + provided_deps + gwt_deps,
provided_deps = ['//gerrit-%s-api:lib' % type] +
provided_deps +
GWT_PLUGIN_DEPS,
visibility = ['PUBLIC'],
)
if gwt_module:
java_library(
name = name + '__gwt_module',
srcs = [],
resources = list(set(srcs + resources)),
deps = deps,
provided_deps = ['//lib/gwt:dev'] +
GWT_PLUGIN_DEPS,
visibility = ['PUBLIC'],
)
prebuilt_jar(
name = '%s-static-jar' % name,
binary_jar = ':%s-static' % name,
@ -157,8 +166,8 @@ def gerrit_plugin(
gwt_binary(
name = name + '__gwt_application',
modules = [gwt_module],
deps = gwt_deps,
module_deps = [':%s__plugin' % name],
deps = GWT_PLUGIN_DEPS,
module_deps = [':%s__gwt_module' % name],
local_workers = cpu_count(),
strict = True,
experimental_args = GWT_COMPILER_ARGS,