More app BUCK file refactoring

Change-Id: I97506033c4c0cf145c558df7d4f86f37c7fe8332
diff --git a/apps/cordmcast/BUCK b/apps/cordmcast/BUCK
index 4da724a..17fe93f 100644
--- a/apps/cordmcast/BUCK
+++ b/apps/cordmcast/BUCK
@@ -1,34 +1,25 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-cord-mcast'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:javax.ws.rs-api',
     '//lib:jersey-client',
     '//lib:jersey-common',
     '//utils/rest:onlab-rest',
-    '//apps/olt:onos-app-olt-api',
+    '//apps/olt:onos-apps-olt-api',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    '//apps/olt:onos-apps-olt-api',
+    '//apps/cordmcast:onos-apps-cordmcast',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'CORD Multicast App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'CORD Multicast application',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/cordvtn/BUCK b/apps/cordvtn/BUCK
index d8a87fb..b06ce4c 100644
--- a/apps/cordvtn/BUCK
+++ b/apps/cordvtn/BUCK
@@ -9,14 +9,31 @@
     '//utils/rest:onlab-rest',
     '//cli:onos-cli',
     '//core/store/serializers:onos-core-serializers',
+    '//apps/openstackinterface:onos-apps-openstackinterface-api',
     '//apps/dhcp/api:onos-apps-dhcp-api',
     '//protocols/ovsdb/api:onos-ovsdb-api',
     '//protocols/ovsdb/rfc:onos-ovsdb-rfc',
 ]
 
+BUNDLES = [
+    '//apps/openstackinterface:onos-apps-openstackinterface-api',
+    '//apps/cordvtn:onos-apps-cordvtn',
+]
+
+EXCLUDED_BUNDLES = [
+    '//lib:jsch', # TODO - needs wrap
+]
+
 osgi_jar_with_tests (
     deps = COMPILE_DEPS,
     web_context = '/onos/cordvtn',
 )
 
-#FIXME need onos_app
\ No newline at end of file
+onos_app (
+    title = 'CORD VTN REST API',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    included_bundles = BUNDLES,
+    excluded_bundles = EXCLUDED_BUNDLES,
+    description = 'APIs for interacting with the CORD VTN application.',
+)
diff --git a/apps/graphitemetrics/BUCK b/apps/graphitemetrics/BUCK
index 858d542..7082797 100644
--- a/apps/graphitemetrics/BUCK
+++ b/apps/graphitemetrics/BUCK
@@ -1,32 +1,28 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-graphite'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:gmetric4j',
     '//lib:metrics-graphite',
 ]
 
+EXCLUDED_BUNDLES = [
+    '//lib:gmetric4j',
+    '//lib:metrics-graphite',
+]
+
 TEST_DEPS = [
     '//lib:TEST',
     '//core/api:onos-api-tests',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
+    test_deps = TEST_DEPS,
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'Graphite Report and Query App',
+    category = 'Monitoring',
+    url = 'http://onosproject.org',
+    description = 'Performance metric service reporter and retriever for graphite',
+    excluded_bundles = EXCLUDED_BUNDLES,
 )
diff --git a/apps/igmp/BUCK b/apps/igmp/BUCK
index 4f7a70f..1369370 100644
--- a/apps/igmp/BUCK
+++ b/apps/igmp/BUCK
@@ -1,32 +1,23 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-igmp'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:org.apache.karaf.shell.console',
     '//cli:onos-cli',
-    '//apps/olt:onos-app-olt-api',
+    '//apps/olt:onos-apps-olt-api',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    '//apps/olt:onos-apps-olt-api',
+    '//apps/igmp:onos-apps-igmp',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'IGMP App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Internet Group Message Protocol',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/influxdbmetrics/BUCK b/apps/influxdbmetrics/BUCK
index a7305c9..9df1a24 100644
--- a/apps/influxdbmetrics/BUCK
+++ b/apps/influxdbmetrics/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-influxdb'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:org.apache.karaf.shell.console',
@@ -12,22 +6,26 @@
     '//cli:onos-cli',
 ]
 
+EXCLUDED_BUNDLES = [
+    '//lib:metrics-influxdb',
+    '//lib:influxdb-java',
+]
+
 TEST_DEPS = [
     '//lib:TEST_ADAPTERS',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
+    test_deps = TEST_DEPS,
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+# TODO : Currently non-functional, needs the ability to wrap a non-OSGI jar
+
+onos_app (
+    title = 'InfluxDB Report and Query App',
+    category = 'Monitoring',
+    url = 'http://onosproject.org',
+    description = 'Performance metric service reporter and retriever for influxDB.',
+    excluded_bundles = EXCLUDED_BUNDLES,
 )
diff --git a/apps/iptopology-api/BUCK b/apps/iptopology-api/BUCK
index d51b6a8..3cc9301 100644
--- a/apps/iptopology-api/BUCK
+++ b/apps/iptopology-api/BUCK
@@ -1,29 +1,8 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-iptopology-api'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
-)
diff --git a/apps/metrics/BUCK b/apps/metrics/BUCK
index eb607f1..a4b7f4c 100644
--- a/apps/metrics/BUCK
+++ b/apps/metrics/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-metrics'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:org.apache.karaf.shell.console',
@@ -12,24 +6,13 @@
     '//cli:onos-cli',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
-    resources_root = 'src/main/resources',
-    resources = glob(['src/main/resources/**']),
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'OpenStack Interface App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'Openstack Interface Application.',
 )
diff --git a/apps/mfwd/BUCK b/apps/mfwd/BUCK
index 64f3755..2d20a48 100644
--- a/apps/mfwd/BUCK
+++ b/apps/mfwd/BUCK
@@ -1,29 +1,14 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-mfwd'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'Multicast Forwarding App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Multicast forwarding application.',
 )
diff --git a/apps/mlb/BUCK b/apps/mlb/BUCK
index e1a2d53..aeb9dce 100644
--- a/apps/mlb/BUCK
+++ b/apps/mlb/BUCK
@@ -1,29 +1,14 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-mlb'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'Mastership Load Balancer App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'Application that balances mastership among nodes.',
 )
diff --git a/apps/mobility/BUCK b/apps/mobility/BUCK
index 1e39b6d..d2b076e 100644
--- a/apps/mobility/BUCK
+++ b/apps/mobility/BUCK
@@ -1,29 +1,14 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-mobility'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'Host Mobility App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'Host mobility application.',
 )
diff --git a/apps/olt/BUCK b/apps/olt/BUCK
index 33cfd41..bc37a53 100644
--- a/apps/olt/BUCK
+++ b/apps/olt/BUCK
@@ -1,6 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:javax.ws.rs-api',
@@ -11,38 +8,28 @@
     '//core/store/serializers:onos-core-serializers',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    ':onos-apps-olt-api',
+    ':onos-apps-olt',
 ]
 
-java_library(
-    name = 'onos-app-olt-api',
+osgi_jar_with_tests (
+    name = 'onos-apps-olt-api',
     srcs = glob(['api/' + SRC + '*.java']),
     deps = COMPILE_DEPS,
     visibility = ['PUBLIC'],
 )
 
-java_test(
-    name = 'onos-app-olt-api-tests',
-    srcs = glob([TEST + 'api/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-olt-api'],
-    source_under_test = [':onos-app-olt-api'],
-)
-
-java_library(
-    name = 'onos-app-olt-app',
+osgi_jar_with_tests (
     srcs = glob(['app/' + SRC + '*.java']),
-    deps = COMPILE_DEPS + [':onos-app-olt-api'],
+    deps = COMPILE_DEPS + [':onos-apps-olt-api'],
     visibility = ['PUBLIC'],
 )
 
-java_test(
-    name = 'onos-app-olt-app-tests',
-    srcs = glob([TEST + 'app/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-olt-api', ':onos-app-olt-app'],
-    source_under_test = [':onos-app-olt-app'],
+onos_app (
+    title = 'ONOS OLT REST API',
+    category = 'Security',
+    url = 'http://onosproject.org',
+    description = 'OLT application for CORD.',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/openstackinterface/BUCK b/apps/openstackinterface/BUCK
index 9a1d458..05f3ee3 100644
--- a/apps/openstackinterface/BUCK
+++ b/apps/openstackinterface/BUCK
@@ -7,38 +7,26 @@
     '//lib:javax.ws.rs-api',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    '//apps/openstackinterface:onos-apps-openstackinterface-api',
+    # TODO - this doesn't actually work now, have to refactor the BUCK files into each sub directory
 ]
 
-java_library(
-    name = 'onos-app-openstackinterface-api',
+osgi_jar_with_tests (
+    name = 'onos-apps-openstackinterface-api',
     srcs = glob(['api/' + SRC + '*.java']),
     deps = COMPILE_DEPS,
     visibility = ['PUBLIC'],
 )
 
-java_test(
-    name = 'onos-app-openstackinterface-api-tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-openstackinterface-api'],
-    source_under_test = [':onos-app-openstackinterface-api'],
+osgi_jar_with_tests (
+    deps = COMPILE_DEPS,
 )
 
-java_library(
-    name = 'onos-app-openstackinterface-app',
-    srcs = glob(['app/' + SRC + '*.java']),
-    deps = COMPILE_DEPS + [':onos-app-openstackinterface-api'],
-    visibility = ['PUBLIC'],
-)
-
-java_test(
-    name = 'onos-app-openstackinterface-app-tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [':onos-app-openstackinterface-api', ':onos-app-openstackinterface-app'],
-    source_under_test = [':onos-app-openstackinterface-app'],
+onos_app (
+    title = 'Authentication App',
+    category = 'Security',
+    url = 'http://onosproject.org',
+    description = 'ONOS authentication application.',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/openstacknetworking/BUCK b/apps/openstacknetworking/BUCK
index 73babee..ef92536 100644
--- a/apps/openstacknetworking/BUCK
+++ b/apps/openstacknetworking/BUCK
@@ -5,7 +5,7 @@
     '//lib:CORE_DEPS',
     '//lib:jersey-client',
     '//lib:javax.ws.rs-api',
-    '//apps/openstackinterface:onos-app-openstackinterface-api',
+    '//apps/openstackinterface:onos-apps-openstackinterface-api',
     '//core/store/serializers:onos-core-serializers',
 ]
 
diff --git a/apps/openstacknode/BUCK b/apps/openstacknode/BUCK
index 37680a8..f96abca 100644
--- a/apps/openstacknode/BUCK
+++ b/apps/openstacknode/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-openstacknode'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//protocols/ovsdb/api:onos-ovsdb-api',
@@ -11,22 +5,6 @@
     '//core/store/serializers:onos-core-serializers',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
 )
diff --git a/apps/optical/BUCK b/apps/optical/BUCK
index 62512c3..49a3743 100644
--- a/apps/optical/BUCK
+++ b/apps/optical/BUCK
@@ -1,29 +1,14 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-optical'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'Packet/Optical Use-Case App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Packet/Optical use-case application.',
 )
diff --git a/apps/pathpainter/BUCK b/apps/pathpainter/BUCK
index 4debeb7..fd1aed5 100644
--- a/apps/pathpainter/BUCK
+++ b/apps/pathpainter/BUCK
@@ -1,31 +1,16 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-pp'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'Path Visualization App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'Path visualization application.',
 )
diff --git a/apps/pcep-api/BUCK b/apps/pcep-api/BUCK
index 1b57c89..580f549 100644
--- a/apps/pcep-api/BUCK
+++ b/apps/pcep-api/BUCK
@@ -1,31 +1,16 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-pcep-api'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//protocols/ovsdb/api:onos-ovsdb-api',
     '//protocols/ovsdb/rfc:onos-ovsdb-rfc',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'PCEP Protocol API',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'PCEP protocol API.',
 )
diff --git a/apps/pim/BUCK b/apps/pim/BUCK
index 02c4cfb..1126966 100644
--- a/apps/pim/BUCK
+++ b/apps/pim/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-pim'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:org.apache.karaf.shell.console',
@@ -12,24 +6,21 @@
     '//apps/routing-api:onos-apps-routing-api',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
+BUNDLES = [
+    '//apps/routing-api:onos-apps-routing-api',
+    ':onos-apps-pim',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'Protocol Independent Multicast Emulation App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Protocol independent multicast emulation.',
+    included_bundles = BUNDLES,
 )
diff --git a/apps/reactive-routing/BUCK b/apps/reactive-routing/BUCK
new file mode 100644
index 0000000..81feab9
--- /dev/null
+++ b/apps/reactive-routing/BUCK
@@ -0,0 +1,16 @@
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-apps-routing-api',
+]
+
+osgi_jar (
+    deps = COMPILE_DEPS,
+)
+
+onos_app (
+    title = 'SDN-IP Reactive Routing App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'SDN-IP reactive routing application.',
+)
diff --git a/apps/sdnip/BUCK b/apps/sdnip/BUCK
index d0bd4fd..89e05e3a 100644
--- a/apps/sdnip/BUCK
+++ b/apps/sdnip/BUCK
@@ -1,33 +1,29 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-sdnip'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//incubator/api:onos-incubator-api',
     '//apps/routing-api:onos-apps-routing-api',
 ]
 
+BUNDLES = [
+    '//apps/routing-api:onos-apps-routing-api',
+    '//apps/sdnip:onos-apps-sdnip',
+]
+
 TEST_DEPS = [
     '//lib:TEST_ADAPTERS',
     '//incubator/api:onos-incubator-api-tests',
     '//apps/routing-api:onos-apps-routing-api-tests',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
+    test_deps = TEST_DEPS,
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+  title = 'SDN-IP App',
+  category = 'Utility',
+  url = 'http://onosproject.org',
+  included_bundles = BUNDLES,
+  description = 'SDN-IP peering application',
 )
diff --git a/apps/virtualbng/BUCK b/apps/virtualbng/BUCK
index 126723f..8eb51e1 100644
--- a/apps/virtualbng/BUCK
+++ b/apps/virtualbng/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-virtualbng'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:jersey-client',
@@ -13,24 +7,15 @@
     '//utils/rest:onlab-rest',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'Virtual Broadband Gateway App',
+    category = 'Utility',
+    url = 'http://onosproject.org',
+    description = 'A virtual Broadband Network Gateway(BNG) application.',
 )
diff --git a/apps/vpls/BUCK b/apps/vpls/BUCK
index 745db32..008cfcb 100644
--- a/apps/vpls/BUCK
+++ b/apps/vpls/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-vpls'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:jersey-client',
@@ -19,18 +13,14 @@
     '//lib:TEST_ADAPTERS',
 ]
 
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
+    test_deps = TEST_DEPS,
 )
 
-java_test(
-    name = 'tests',
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
+onos_app (
+    title = 'VLAN L2 Broadcast Network App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Application to create L2 broadcast network using VLAN.',
 )
diff --git a/apps/vrouter/BUCK b/apps/vrouter/BUCK
index c6ce965..9f4591d 100644
--- a/apps/vrouter/BUCK
+++ b/apps/vrouter/BUCK
@@ -1,30 +1,15 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-app-vrouter'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//incubator/api:onos-incubator-api',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-java_library(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+osgi_jar_with_tests (
     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],
+onos_app (
+    title = 'Virtual Router App',
+    category = 'Traffic Steering',
+    url = 'http://onosproject.org',
+    description = 'Virtual router (vRouter) application.',
 )