gerrit/plugins/BUCK
David Ostrovsky 5dacc8bcc2 Buck: Make deps to $(exe :foo) and $(location :bar) implicitly
Apply [1] on our Buck tree.

[1] https://github.com/facebook/buck/issues/128

Change-Id: Ie3a9de0b2ee3725170bcbd06df059ea5d9ae5252
2014-06-10 07:29:42 +00:00

39 lines
1023 B
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 filter(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 = filter(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'],
)