gerrit/tools/java_doc.defs
David Ostrovsky d9cafb7ca2 Buck: Fix java_doc rule to use $(classpath :foo) macro
java_doc rule was using $(location :foo) instead of $(classpath :foo)
macro. This is similar but not the same. The subtle difference is the
replacement that is done for java_library() when only exported deps are
used. While location macro doesn't work here, because there are no out
file associated with such a java_library, classpath macro correctly
resolves the dependencies.

Change-Id: Iab67dff9c332027765bc0da8c46810de11974de8
2016-02-14 20:22:19 +01:00

39 lines
853 B
Plaintext

def java_doc(
name,
title,
pkgs,
paths,
srcs = [],
deps = [],
visibility = [],
do_it_wrong = False,
):
if do_it_wrong:
sourcepath = paths
else:
sourcepath = ['$SRCDIR/' + n for n in paths]
genrule(
name = name,
cmd = ' '.join([
'while ! test -f .buckconfig; do cd ..; done;',
'javadoc',
'-quiet',
'-protected',
'-encoding UTF-8',
'-charset UTF-8',
'-notimestamp',
'-windowtitle "' + title + '"',
'-link http://docs.oracle.com/javase/7/docs/api',
'-subpackages ',
':'.join(pkgs),
'-sourcepath ',
':'.join(sourcepath),
' -classpath ',
':'.join(['$(classpath %s)' % n for n in deps]),
'-d $TMP',
]) + ';jar cf $OUT -C $TMP .',
srcs = srcs,
out = name + '.jar',
visibility = visibility,
)