Brian O'Connor
Committed by Thomas Vachuska

Buckifying DHCP app

Change-Id: I9af53efa8bb0294f5f2c677ac2d8bb0b5e4cf282
1 +
2 +BUNDLES = [
3 + ('//apps/dhcp/api:onos-app-dhcp-api', ONOS_GROUP_ID + ':' + 'onos-app-dhcp-api' + ':' + ONOS_VERSION),
4 + ('//apps/dhcp/app:onos-app-dhcp-app', ONOS_GROUP_ID + ':' + 'onos-app-dhcp-app' + ':' + ONOS_VERSION),
5 +]
6 +
7 +onos_app(
8 + app_name = 'org.onosproject.dhcp',
9 + feature_name = ONOS_GROUP_ID + ':onos-app-dhcp:' + ONOS_VERSION,
10 + title = 'DHCP Server App',
11 + category = 'Utility',
12 + url = 'http://onosproject.org',
13 + included_bundles = BUNDLES,
14 +)
...@@ -12,7 +12,7 @@ TEST_DEPS = [ ...@@ -12,7 +12,7 @@ TEST_DEPS = [
12 '//lib:TEST', 12 '//lib:TEST',
13 ] 13 ]
14 14
15 -java_library( 15 +osgi_jar(
16 name = CURRENT_NAME, 16 name = CURRENT_NAME,
17 srcs = glob([SRC + '/*.java']), 17 srcs = glob([SRC + '/*.java']),
18 deps = COMPILE_DEPS, 18 deps = COMPILE_DEPS,
......
1 -SRC = 'src/main/java/org/onosproject/**/'
2 -TEST = 'src/test/java/org/onosproject/**/'
3 -
4 CURRENT_NAME = 'onos-app-dhcp-app' 1 CURRENT_NAME = 'onos-app-dhcp-app'
5 -CURRENT_TARGET = ':' + CURRENT_NAME
6 2
7 COMPILE_DEPS = [ 3 COMPILE_DEPS = [
8 '//lib:CORE_DEPS', 4 '//lib:CORE_DEPS',
...@@ -18,18 +14,12 @@ TEST_DEPS = [ ...@@ -18,18 +14,12 @@ TEST_DEPS = [
18 '//lib:TEST_ADAPTERS', 14 '//lib:TEST_ADAPTERS',
19 ] 15 ]
20 16
21 -java_library( 17 +osgi_jar(
22 name = CURRENT_NAME, 18 name = CURRENT_NAME,
23 - srcs = glob([SRC + '/*.java']),
24 deps = COMPILE_DEPS, 19 deps = COMPILE_DEPS,
25 - visibility = ['PUBLIC'], 20 + srcs = glob([SRC + '/*.java']),
26 -) 21 + resources = glob([RESOURCES_ROOT + '**']),
27 - 22 + test_srcs = glob([TEST + '/*.java']),
28 -java_test( 23 + test_deps = TEST_DEPS,
29 - name = 'tests', 24 + web_context = '/onos/dhcp',
30 - srcs = glob([TEST + '/*.java']),
31 - deps = COMPILE_DEPS +
32 - TEST_DEPS +
33 - [CURRENT_TARGET],
34 - source_under_test = [CURRENT_TARGET],
35 ) 25 )
......
...@@ -4,15 +4,21 @@ DEBUG_ARG='JAVA_TOOL_OPTIONS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,add ...@@ -4,15 +4,21 @@ DEBUG_ARG='JAVA_TOOL_OPTIONS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,add
4 FORCE_INSTALL=True 4 FORCE_INSTALL=True
5 NONE='NONE' 5 NONE='NONE'
6 6
7 +SRC = 'src/main/java/org/onosproject/**/'
8 +TEST = 'src/test/java/org/onosproject/**/'
9 +RESOURCES_ROOT = 'src/main/resources/'
10 +
7 ONOS_GROUP_ID = 'org.onosproject' 11 ONOS_GROUP_ID = 'org.onosproject'
8 ONOS_VERSION = '1.6.0-SNAPSHOT' 12 ONOS_VERSION = '1.6.0-SNAPSHOT'
9 13
10 def osgi_jar( 14 def osgi_jar(
11 name, 15 name,
12 srcs, 16 srcs,
17 + test_srcs = None,
13 group_id = ONOS_GROUP_ID, 18 group_id = ONOS_GROUP_ID,
14 version = ONOS_VERSION, 19 version = ONOS_VERSION,
15 deps = [], 20 deps = [],
21 + test_deps = [ '//lib:TEST' ],
16 visibility = ['PUBLIC'], 22 visibility = ['PUBLIC'],
17 license = 'NONE', 23 license = 'NONE',
18 description = '', 24 description = '',
...@@ -21,6 +27,10 @@ def osgi_jar( ...@@ -21,6 +27,10 @@ def osgi_jar(
21 export_packages = '*', 27 export_packages = '*',
22 include_resources = NONE, 28 include_resources = NONE,
23 web_context = NONE, 29 web_context = NONE,
30 + resources = None,
31 + resources_root = None,
32 + test_resources = None,
33 + test_resources_root = None,
24 **kwargs 34 **kwargs
25 ): 35 ):
26 36
...@@ -28,11 +38,16 @@ def osgi_jar( ...@@ -28,11 +38,16 @@ def osgi_jar(
28 osgi_jar_name = name + '-osgi' 38 osgi_jar_name = name + '-osgi'
29 mvn_coords = group_id + ':' + name + ':' + version 39 mvn_coords = group_id + ':' + name + ':' + version
30 40
41 + if resources and not resources_root:
42 + resources_root = RESOURCES_ROOT
43 +
31 java_library( 44 java_library(
32 name = bare_jar_name, 45 name = bare_jar_name,
33 srcs = srcs, 46 srcs = srcs,
34 deps = deps, 47 deps = deps,
35 - visibility = ['PUBLIC'], 48 + visibility = [], #intentially, not visible
49 + resources = resources,
50 + resources_root = resources_root,
36 **kwargs 51 **kwargs
37 ) 52 )
38 53
...@@ -113,3 +128,18 @@ def osgi_jar( ...@@ -113,3 +128,18 @@ def osgi_jar(
113 visibility = visibility, 128 visibility = visibility,
114 ) 129 )
115 130
131 +
132 + if test_resources and not test_resources_root:
133 + test_resources_root = RESOURCES_ROOT
134 +
135 + if test_srcs:
136 + java_test(
137 + name = 'tests',
138 + srcs = test_srcs,
139 + deps = deps +
140 + test_deps +
141 + [':' + bare_jar_name],
142 + source_under_test = [':' + bare_jar_name],
143 + resources = test_resources,
144 + resources_root = test_resources_root
145 + )
......