Shawn Pearce | fd6bb9f | 2013-05-08 14:14:24 -0700 | [diff] [blame] | 1 | BASE = get_base_path() |
| 2 | CORE = [ |
| 3 | 'commit-message-length-validator', |
| 4 | 'replication', |
| 5 | 'reviewnotes', |
| 6 | ] |
| 7 | |
| 8 | # buck audit parses and resolves all deps even if not reachable |
| 9 | # from the root(s) passed to audit. Filter dependencies to only |
| 10 | # the ones that currently exist to allow buck to parse cleanly. |
| 11 | # TODO(sop): buck should more lazily resolve deps |
| 12 | def filter(names): |
| 13 | from os import path |
| 14 | h, n = [], [] |
| 15 | for p in names: |
| 16 | if path.exists(path.join(BASE, p, 'BUCK')): |
| 17 | h.append(p) |
| 18 | else: |
| 19 | n.append(p) |
| 20 | return h, n |
| 21 | HAVE, NEED = filter(CORE) |
| 22 | |
| 23 | genrule( |
| 24 | name = 'core', |
| 25 | cmd = '' + |
| 26 | ';'.join(['echo >&2 plugins/'+n+' is required.' for n in NEED]) + |
| 27 | (';echo >&2;exit 1;' if NEED else '') + |
Shawn Pearce | a0c9372 | 2013-05-10 11:20:55 -0700 | [diff] [blame] | 28 | 'mkdir -p $TMP/WEB-INF/plugins;' + |
Shawn Pearce | fd6bb9f | 2013-05-08 14:14:24 -0700 | [diff] [blame] | 29 | 'for s in $SRCS;do ln -s $s $TMP/WEB-INF/plugins;done;' + |
Shawn Pearce | a0c9372 | 2013-05-10 11:20:55 -0700 | [diff] [blame] | 30 | 'cd $TMP;' + |
Shawn Pearce | fd6bb9f | 2013-05-08 14:14:24 -0700 | [diff] [blame] | 31 | 'zip -qr $OUT .', |
| 32 | srcs = [genfile('%s/%s.jar' % (n, n)) for n in CORE], |
| 33 | deps = ['//%s/%s:%s' % (BASE, n, n) for n in HAVE], |
| 34 | out = 'core.zip', |
| 35 | visibility = ['//:release'], |
| 36 | ) |