Files
gerrit/tools/java_doc.defs
David Ostrovsky c13d8feb30 Buck: Create javadoc from source archive
javadoc accepts source archive and we need to create one anyway. So
instead of trying to use the sources in the tree and guess the root
project directory, just use the source archive. We extact the archive
in temporary directory to make javadoc work.

Change-Id: Ib605f6cdab4742a23789da8fbc9c963c83e5b6d9
2016-09-07 22:49:38 +02:00

36 lines
897 B
Plaintext

def java_doc(
name,
title,
pkgs,
source_jar,
srcs = [],
deps = [],
visibility = [],
):
# TODO(davido): Actually we shouldn't need to extract the source
# archive, javadoc should just work with provided archive.
genrule(
name = name,
cmd = ' '.join([
'mkdir $TMP/sourcepath &&',
'unzip $(location %s) -d $TMP/sourcepath &&' % source_jar,
'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 $TMP/sourcepath',
' -classpath ',
':'.join(['$(classpath %s)' % n for n in deps]),
'-d $TMP',
]) + ';jar cf $OUT -C $TMP .',
srcs = srcs,
out = name + '.jar',
visibility = visibility,
)