def java_doc( | |
name, | |
title, | |
pkgs, | |
source_jar, | |
srcs = [], | |
deps = [], | |
visibility = [], | |
external_docs = [], | |
): | |
# TODO(davido): Actually we shouldn't need to extract the source | |
# archive, javadoc should just work with provided archive. | |
external_docs.insert(0, 'http://docs.oracle.com/javase/8/docs/api') | |
genrule( | |
name = name, | |
cmd = ' '.join([ | |
'mkdir $TMP/sourcepath &&', | |
'unzip $(location %s) -d $TMP/sourcepath &&' % source_jar, | |
'javadoc', | |
'-Xdoclint:-missing', | |
'-quiet', | |
'-protected', | |
'-encoding UTF-8', | |
'-charset UTF-8', | |
'-notimestamp', | |
'-windowtitle "' + title + '"', | |
' '.join(['-link %s' % url for url in external_docs]), | |
'-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, | |
) |