Buck: Make gwt_module() rule more pythonic
gwt_module() rule is a normal java_library() rule with optional xml description of the GWT module included in resources list. The current implementation of this rule maps hard coded all parameters from gwt_module() to java_library(). This is not future proof, as java_library() may become additional parameters, like provided_deps recently and the implementation must be extended. This change provides alternative implementation that copy parameter list in generic way, adding GWT xml to resources list on the fly. Inspired-By: Michael Bolin <mbolin@fb.com> Change-Id: I7f1ee1d6b3e142f14a199e80dea4e91817b5c7d5
This commit is contained in:
parent
834708c8ea
commit
4af374c5af
@ -15,6 +15,7 @@
|
||||
# Rule definitions loaded by default into every BUCK file.
|
||||
|
||||
include_defs('//tools/gwt-constants.defs')
|
||||
import copy
|
||||
|
||||
def genantlr(
|
||||
name,
|
||||
@ -31,22 +32,15 @@ def genantlr(
|
||||
out = out,
|
||||
)
|
||||
|
||||
def gwt_module(
|
||||
name,
|
||||
srcs,
|
||||
gwtxml = None,
|
||||
resources = [],
|
||||
deps = [],
|
||||
visibility = []):
|
||||
def gwt_module(gwtxml=None, **kwargs):
|
||||
kw = copy.deepcopy(kwargs)
|
||||
if 'resources' not in kw:
|
||||
kw['resources'] = []
|
||||
if gwtxml:
|
||||
resources = resources + [gwtxml]
|
||||
java_library(
|
||||
name = name,
|
||||
srcs = srcs,
|
||||
deps = deps,
|
||||
resources = srcs + resources,
|
||||
visibility = visibility,
|
||||
)
|
||||
kw['resources'] += [gwtxml]
|
||||
if 'srcs' in kw:
|
||||
kw['resources'] += kw['srcs']
|
||||
java_library(**kw)
|
||||
|
||||
def gerrit_extension(
|
||||
name,
|
||||
|
Loading…
Reference in New Issue
Block a user