gerrit/plugins/BUCK
David Pursehouse 43050f6cde plugins: rename 'filter' method in BUCK file
The name 'filter' overrides a python built-in method.

Change-Id: I187d4d34a9c757d76d76d7707156c7482ea59fb4
2015-12-09 15:08:15 +09:00

39 lines
1.0 KiB
Python

BASE = get_base_path()
CORE = [
'commit-message-length-validator',
'download-commands',
'replication',
'reviewnotes',
'singleusergroup'
]
# buck audit parses and resolves all deps even if not reachable
# from the root(s) passed to audit. Filter dependencies to only
# the ones that currently exist to allow buck to parse cleanly.
# TODO(sop): buck should more lazily resolve deps
def core_plugins(names):
from os import path
h, n = [], []
for p in names:
if path.exists(path.join(BASE, p, 'BUCK')):
h.append(p)
else:
n.append(p)
return h, n
HAVE, NEED = core_plugins(CORE)
genrule(
name = 'core',
cmd = '' +
';'.join(['echo >&2 plugins/'+n+' is required.' for n in NEED]) +
(';echo >&2;exit 1;' if NEED else '') +
'mkdir -p $TMP/WEB-INF/plugins;' +
'for s in ' +
' '.join(['$(location //%s/%s:%s)' % (BASE, n, n) for n in HAVE]) +
';do ln -s $s $TMP/WEB-INF/plugins;done;' +
'cd $TMP;' +
'zip -qr $OUT .',
out = 'core.zip',
visibility = ['//:release'],
)