Ray Milkey | f80bbb2 | 2016-03-11 10:16:22 -0800 | [diff] [blame] | 1 | def java_doc( |
| 2 | name, |
| 3 | title, |
| 4 | pkgs, |
| 5 | paths, |
| 6 | srcs = [], |
| 7 | deps = [], |
| 8 | visibility = [], |
| 9 | do_it_wrong = False, |
| 10 | ): |
| 11 | if do_it_wrong: |
| 12 | sourcepath = paths |
| 13 | else: |
| 14 | sourcepath = ['$SRCDIR/' + n for n in paths] |
| 15 | genrule( |
| 16 | name = name, |
| 17 | cmd = ' '.join([ |
| 18 | 'while ! test -f .buckconfig; do cd ..; done;', |
| 19 | 'javadoc', |
| 20 | '-quiet', |
| 21 | '-protected', |
| 22 | '-encoding UTF-8', |
| 23 | '-charset UTF-8', |
| 24 | '-notimestamp', |
| 25 | '-windowtitle "' + title + '"', |
| 26 | '-link http://docs.oracle.com/javase/7/docs/api', |
| 27 | '-subpackages ', |
| 28 | ':'.join(pkgs), |
| 29 | '-sourcepath ', |
| 30 | ':'.join(sourcepath), |
| 31 | ' -classpath ', |
| 32 | ':'.join(['$(classpath %s)' % n for n in deps]), |
| 33 | '-d $TMP', |
| 34 | ]) + ';jar cf $OUT -C $TMP .', |
| 35 | srcs = srcs, |
| 36 | out = name + '.jar', |
| 37 | visibility = visibility, |
| 38 | ) |