Ray Milkey
Committed by Gerrit Code Review

Javadoc for a single module using BUCK

Part of ONOS-4519

Change-Id: I05e4c25c88dad26b407c8787484a50c502b1d87b
...@@ -52,6 +52,46 @@ def checkstyle( ...@@ -52,6 +52,46 @@ def checkstyle(
52 else: 52 else:
53 print 'Not generating checkstyle rule for %s because there are no sources.' % name 53 print 'Not generating checkstyle rule for %s because there are no sources.' % name
54 54
55 +def java_doc(
56 + name,
57 + title,
58 + pkgs,
59 + paths,
60 + srcs = [],
61 + deps = [],
62 + visibility = [],
63 + do_it_wrong = False,
64 + ):
65 + if do_it_wrong:
66 + sourcepath = paths
67 + else:
68 + sourcepath = ['$SRCDIR/' + n for n in paths]
69 + genrule(
70 + name = name,
71 + cmd = ' '.join([
72 + 'while ! test -f .buckconfig; do cd ..; done;',
73 + 'javadoc',
74 + '-quiet',
75 + '-protected',
76 + '-encoding UTF-8',
77 + '-charset UTF-8',
78 + '-notimestamp',
79 + '-windowtitle "' + title + '"',
80 + '-link http://docs.oracle.com/javase/7/docs/api',
81 + '-subpackages ',
82 + ':'.join(pkgs),
83 + '-sourcepath ',
84 + ':'.join(sourcepath),
85 + ' -classpath ',
86 + ':'.join(['$(classpath %s)' % n for n in deps]),
87 + '-d $TMP',
88 + ]) + ';jar cf $OUT -C $TMP .',
89 + srcs = srcs,
90 + out = name + '.jar',
91 + visibility = visibility,
92 +)
93 +
94 +
55 def osgi_jar( 95 def osgi_jar(
56 name = None, 96 name = None,
57 srcs = None, 97 srcs = None,
...@@ -149,6 +189,17 @@ def osgi_jar( ...@@ -149,6 +189,17 @@ def osgi_jar(
149 jar_target = ':'+ bare_jar_name, 189 jar_target = ':'+ bare_jar_name,
150 ) 190 )
151 191
192 + java_doc(
193 + name = name + '-javadoc',
194 + title = 'Java Docs',
195 + pkgs = [ 'org.onosproject' ],
196 + paths = [ 'src/main/java' ],
197 + srcs = srcs,
198 + deps = deps,
199 + visibility = visibility,
200 + do_it_wrong = False,
201 + )
202 +
152 # TODO add project config for intellij 203 # TODO add project config for intellij
153 # project_config( 204 # project_config(
154 # src_target = ':' + bare_jar_name, 205 # src_target = ':' + bare_jar_name,
...@@ -229,3 +280,6 @@ def osgi_jar_with_tests( ...@@ -229,3 +280,6 @@ def osgi_jar_with_tests(
229 ) 280 )
230 281
231 #FIXME need to run checkstyle on test sources 282 #FIXME need to run checkstyle on test sources
283 +
284 +
285 +
......