Ray Milkey

Top level build of component Javadocs

Change-Id: Iceb2a7c84b3dd0b354b27f93a0f746913cd9b778
...@@ -46,6 +46,8 @@ def checkstyle( ...@@ -46,6 +46,8 @@ def checkstyle(
46 test_rule_timeout_ms = 20000, 46 test_rule_timeout_ms = 20000,
47 labels = [ 'checkstyle' ], 47 labels = [ 'checkstyle' ],
48 ) 48 )
49 + else:
50 + print 'Not generating checkstyle rule for %s because there are no sources.' % name
49 51
50 def java_doc( 52 def java_doc(
51 name, 53 name,
...@@ -61,18 +63,19 @@ def java_doc( ...@@ -61,18 +63,19 @@ def java_doc(
61 sourcepath = paths 63 sourcepath = paths
62 else: 64 else:
63 sourcepath = ['$SRCDIR/' + n for n in paths] 65 sourcepath = ['$SRCDIR/' + n for n in paths]
64 - genrule( 66 +
65 - name = name, 67 + if len(srcs) != 0:
66 cmd = ' '.join([ 68 cmd = ' '.join([
67 'while ! test -f .buckconfig; do cd ..; done;', 69 'while ! test -f .buckconfig; do cd ..; done;',
68 'javadoc', 70 'javadoc',
71 + '-tag onos.rsModel:a:"onos model"',
69 '-quiet', 72 '-quiet',
70 '-protected', 73 '-protected',
71 '-encoding UTF-8', 74 '-encoding UTF-8',
72 '-charset UTF-8', 75 '-charset UTF-8',
73 '-notimestamp', 76 '-notimestamp',
74 '-windowtitle "' + title + '"', 77 '-windowtitle "' + title + '"',
75 - '-link http://docs.oracle.com/javase/7/docs/api', 78 + '-link http://docs.oracle.com/javase/8/docs/api',
76 '-subpackages ', 79 '-subpackages ',
77 ':'.join(pkgs), 80 ':'.join(pkgs),
78 '-sourcepath ', 81 '-sourcepath ',
...@@ -80,7 +83,11 @@ def java_doc( ...@@ -80,7 +83,11 @@ def java_doc(
80 ' -classpath ', 83 ' -classpath ',
81 ':'.join(['$(classpath %s)' % n for n in deps]), 84 ':'.join(['$(classpath %s)' % n for n in deps]),
82 '-d $TMP', 85 '-d $TMP',
83 - ]) + ';jar cf $OUT -C $TMP .', 86 + ]) + ';jar cf $OUT -C $TMP .'
87 +
88 + genrule(
89 + name = name,
90 + cmd = cmd,
84 srcs = srcs, 91 srcs = srcs,
85 out = name + '.jar', 92 out = name + '.jar',
86 visibility = visibility, 93 visibility = visibility,
...@@ -99,6 +106,7 @@ def osgi_jar( ...@@ -99,6 +106,7 @@ def osgi_jar(
99 debug = False, 106 debug = False,
100 import_packages = '*', 107 import_packages = '*',
101 export_packages = '*', 108 export_packages = '*',
109 + package_name_root = 'org.onosproject',
102 include_resources = NONE, 110 include_resources = NONE,
103 web_context = NONE, 111 web_context = NONE,
104 resources = NONE, 112 resources = NONE,
...@@ -187,7 +195,7 @@ def osgi_jar( ...@@ -187,7 +195,7 @@ def osgi_jar(
187 java_doc( 195 java_doc(
188 name = name + '-javadoc', 196 name = name + '-javadoc',
189 title = 'Java Docs', 197 title = 'Java Docs',
190 - pkgs = [ 'org.onosproject' ], 198 + pkgs = [ package_name_root ],
191 paths = [ 'src/main/java' ], 199 paths = [ 'src/main/java' ],
192 srcs = srcs, 200 srcs = srcs,
193 deps = deps, 201 deps = deps,
...@@ -253,6 +261,9 @@ def osgi_jar_with_tests( ...@@ -253,6 +261,9 @@ def osgi_jar_with_tests(
253 if test_srcs is None: 261 if test_srcs is None:
254 test_srcs = glob([TEST + '/*.java']) 262 test_srcs = glob([TEST + '/*.java'])
255 263
264 + if not test_srcs:
265 + print "Generating test rule for %s, but there are no tests." % name
266 +
256 java_test( 267 java_test(
257 name = name + '-tests', 268 name = name + '-tests',
258 srcs = test_srcs, 269 srcs = test_srcs,
...@@ -272,6 +283,3 @@ def osgi_jar_with_tests( ...@@ -272,6 +283,3 @@ def osgi_jar_with_tests(
272 ) 283 )
273 284
274 #FIXME need to run checkstyle on test sources 285 #FIXME need to run checkstyle on test sources
275 -
276 -
277 -
......
1 +#!/bin/bash
2 +# -----------------------------------------------------------------------------
3 +# Builds the ONOS Java API docs with buck.
4 +# -----------------------------------------------------------------------------
5 +
6 +set -e
7 +
8 +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1
9 +. $ONOS_ROOT/tools/build/envDefaults
10 +
11 +onos-buck build `onos-buck query "filter('.*-javadoc', '//...')"`
12 +
...@@ -20,6 +20,7 @@ osgi_jar( ...@@ -20,6 +20,7 @@ osgi_jar(
20 visibility = ['PUBLIC'], 20 visibility = ['PUBLIC'],
21 resources_root = 'src/main/resources', 21 resources_root = 'src/main/resources',
22 resources = glob(['src/main/resources/**']), 22 resources = glob(['src/main/resources/**']),
23 + package_name_root = 'org.onlab',
23 ) 24 )
24 25
25 java_test( 26 java_test(
......
...@@ -16,6 +16,7 @@ osgi_jar( ...@@ -16,6 +16,7 @@ osgi_jar(
16 srcs = glob([SRC + '/*.java']), 16 srcs = glob([SRC + '/*.java']),
17 deps = COMPILE_DEPS, 17 deps = COMPILE_DEPS,
18 visibility = ['PUBLIC'], 18 visibility = ['PUBLIC'],
19 + package_name_root = 'org.onlab',
19 ) 20 )
20 21
21 java_test( 22 java_test(
......
...@@ -16,6 +16,7 @@ osgi_jar( ...@@ -16,6 +16,7 @@ osgi_jar(
16 srcs = glob([SRC + '/*.java']), 16 srcs = glob([SRC + '/*.java']),
17 deps = COMPILE_DEPS, 17 deps = COMPILE_DEPS,
18 visibility = ['PUBLIC'], 18 visibility = ['PUBLIC'],
19 + package_name_root = 'org.onlab',
19 ) 20 )
20 21
21 java_test( 22 java_test(
......
...@@ -9,4 +9,5 @@ COMPILE_DEPS = [ ...@@ -9,4 +9,5 @@ COMPILE_DEPS = [
9 osgi_jar_with_tests ( 9 osgi_jar_with_tests (
10 name = 'onlab-rest', 10 name = 'onlab-rest',
11 deps = COMPILE_DEPS, 11 deps = COMPILE_DEPS,
12 + package_name_root = 'org.onlab',
12 ) 13 )
......
...@@ -7,6 +7,7 @@ COMPILE_DEPS = [ ...@@ -7,6 +7,7 @@ COMPILE_DEPS = [
7 '//lib:jersey-media-multipart', 7 '//lib:jersey-media-multipart',
8 '//lib:org.apache.karaf.shell.console', 8 '//lib:org.apache.karaf.shell.console',
9 '//cli:onos-cli', 9 '//cli:onos-cli',
10 + '//lib:jersey-server',
10 '//incubator/api:onos-incubator-api', 11 '//incubator/api:onos-incubator-api',
11 '//incubator/net:onos-incubator-net', 12 '//incubator/net:onos-incubator-net',
12 '//utils/rest:onlab-rest', 13 '//utils/rest:onlab-rest',
......