Add license argument to genrule
We implement the license argument to maven_jar by producing a prebuilt_jar package that includes the license file as a dependency. However, we can't depend on all artifacts that we ever download being jars, so this doesn't work. Instead, just let a genrule provide a license directly, adding it as a dep of the genrule. Of course, genrules can't have deps, so we have to hack them into the command to get buck to pick them up. Change-Id: Ibcabc1ae63eeabf1333616780605314d0429a992
This commit is contained in:
parent
7cadbc0c0c
commit
86524d8644
@ -73,6 +73,18 @@ def _set_auto_value(kwargs):
|
||||
apds.extend(AUTO_VALUE_PROCESSOR_DEPS)
|
||||
|
||||
|
||||
# Add 'license' argument to genrule.
|
||||
_buck_genrule = genrule
|
||||
def genrule(*args, **kwargs):
|
||||
license = kwargs.pop('license', None)
|
||||
if license:
|
||||
license = '//lib:LICENSE-%s' % license
|
||||
# genrule has no deps attribute, but locations listed in the command show
|
||||
# up as deps of the target with buck audit.
|
||||
kwargs['cmd'] = 'true $(location %s); %s' % (license, kwargs['cmd'])
|
||||
_buck_genrule(*args, **kwargs)
|
||||
|
||||
|
||||
def genantlr(
|
||||
name,
|
||||
srcs,
|
||||
|
Loading…
Reference in New Issue
Block a user