From 0f6677d8b3525e944f59d910e8bd14d85f7c076b Mon Sep 17 00:00:00 2001 From: Brian O'Connor Date: Wed, 6 Apr 2016 23:26:51 -0700 Subject: [PATCH] Buckifying DHCP app Change-Id: I9af53efa8bb0294f5f2c677ac2d8bb0b5e4cf282 --- apps/dhcp/BUCK | 14 ++++++++++++++ apps/dhcp/api/BUCK | 2 +- apps/dhcp/app/BUCK | 22 ++++++---------------- bucklets/onos.bucklet | 32 +++++++++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 18 deletions(-) create mode 100644 apps/dhcp/BUCK diff --git a/apps/dhcp/BUCK b/apps/dhcp/BUCK new file mode 100644 index 0000000000..5c811d80a8 --- /dev/null +++ b/apps/dhcp/BUCK @@ -0,0 +1,14 @@ + +BUNDLES = [ + ('//apps/dhcp/api:onos-app-dhcp-api', ONOS_GROUP_ID + ':' + 'onos-app-dhcp-api' + ':' + ONOS_VERSION), + ('//apps/dhcp/app:onos-app-dhcp-app', ONOS_GROUP_ID + ':' + 'onos-app-dhcp-app' + ':' + ONOS_VERSION), +] + +onos_app( + app_name = 'org.onosproject.dhcp', + feature_name = ONOS_GROUP_ID + ':onos-app-dhcp:' + ONOS_VERSION, + title = 'DHCP Server App', + category = 'Utility', + url = 'http://onosproject.org', + included_bundles = BUNDLES, +) diff --git a/apps/dhcp/api/BUCK b/apps/dhcp/api/BUCK index e86c13be43..9989504713 100644 --- a/apps/dhcp/api/BUCK +++ b/apps/dhcp/api/BUCK @@ -12,7 +12,7 @@ TEST_DEPS = [ '//lib:TEST', ] -java_library( +osgi_jar( name = CURRENT_NAME, srcs = glob([SRC + '/*.java']), deps = COMPILE_DEPS, diff --git a/apps/dhcp/app/BUCK b/apps/dhcp/app/BUCK index 5fa8ca73b1..a3b4ea1de0 100644 --- a/apps/dhcp/app/BUCK +++ b/apps/dhcp/app/BUCK @@ -1,8 +1,4 @@ -SRC = 'src/main/java/org/onosproject/**/' -TEST = 'src/test/java/org/onosproject/**/' - CURRENT_NAME = 'onos-app-dhcp-app' -CURRENT_TARGET = ':' + CURRENT_NAME COMPILE_DEPS = [ '//lib:CORE_DEPS', @@ -18,18 +14,12 @@ TEST_DEPS = [ '//lib:TEST_ADAPTERS', ] -java_library( +osgi_jar( name = CURRENT_NAME, - srcs = glob([SRC + '/*.java']), deps = COMPILE_DEPS, - visibility = ['PUBLIC'], -) - -java_test( - name = 'tests', - srcs = glob([TEST + '/*.java']), - deps = COMPILE_DEPS + - TEST_DEPS + - [CURRENT_TARGET], - source_under_test = [CURRENT_TARGET], + srcs = glob([SRC + '/*.java']), + resources = glob([RESOURCES_ROOT + '**']), + test_srcs = glob([TEST + '/*.java']), + test_deps = TEST_DEPS, + web_context = '/onos/dhcp', ) diff --git a/bucklets/onos.bucklet b/bucklets/onos.bucklet index ad6ccf6be2..37a086490e 100644 --- a/bucklets/onos.bucklet +++ b/bucklets/onos.bucklet @@ -4,15 +4,21 @@ DEBUG_ARG='JAVA_TOOL_OPTIONS="-Xdebug -Xrunjdwp:server=y,transport=dt_socket,add FORCE_INSTALL=True NONE='NONE' +SRC = 'src/main/java/org/onosproject/**/' +TEST = 'src/test/java/org/onosproject/**/' +RESOURCES_ROOT = 'src/main/resources/' + ONOS_GROUP_ID = 'org.onosproject' ONOS_VERSION = '1.6.0-SNAPSHOT' def osgi_jar( name, srcs, + test_srcs = None, group_id = ONOS_GROUP_ID, version = ONOS_VERSION, deps = [], + test_deps = [ '//lib:TEST' ], visibility = ['PUBLIC'], license = 'NONE', description = '', @@ -21,6 +27,10 @@ def osgi_jar( export_packages = '*', include_resources = NONE, web_context = NONE, + resources = None, + resources_root = None, + test_resources = None, + test_resources_root = None, **kwargs ): @@ -28,11 +38,16 @@ def osgi_jar( osgi_jar_name = name + '-osgi' mvn_coords = group_id + ':' + name + ':' + version + if resources and not resources_root: + resources_root = RESOURCES_ROOT + java_library( name = bare_jar_name, srcs = srcs, deps = deps, - visibility = ['PUBLIC'], + visibility = [], #intentially, not visible + resources = resources, + resources_root = resources_root, **kwargs ) @@ -113,3 +128,18 @@ def osgi_jar( visibility = visibility, ) + + if test_resources and not test_resources_root: + test_resources_root = RESOURCES_ROOT + + if test_srcs: + java_test( + name = 'tests', + srcs = test_srcs, + deps = deps + + test_deps + + [':' + bare_jar_name], + source_under_test = [':' + bare_jar_name], + resources = test_resources, + resources_root = test_resources_root + )