Appify BUCK builds for drivers

Change-Id: I94a44950ce793008ff2a3b2105207a9fff9a53ed
diff --git a/drivers/bti/BUCK b/drivers/bti/BUCK
index 791f198..c7d6cf7 100644
--- a/drivers/bti/BUCK
+++ b/drivers/bti/BUCK
@@ -1,8 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-bti'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//protocols/snmp/api:onos-snmp-api',
@@ -13,11 +8,16 @@
     '//lib:mibs-net-snmp',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'Bti Device Drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Bti Device Drivers application.',
+    required_apps = [ 'org.onosproject.snmp' ],
+)
diff --git a/drivers/ciena/BUCK b/drivers/ciena/BUCK
index 74c3cd8..6537ee6 100644
--- a/drivers/ciena/BUCK
+++ b/drivers/ciena/BUCK
@@ -1,8 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-ciena'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//incubator/api:onos-incubator-api',
@@ -11,11 +6,16 @@
     '//protocols/rest/api:onos-protocols-rest-api',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'Ciena Device Drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Ciena Device Drivers application.',
+    required_apps = [ 'org.onosproject.restsb' ],
+)
diff --git a/drivers/cisco/BUCK b/drivers/cisco/BUCK
index 2b2e184..b5dbef5 100644
--- a/drivers/cisco/BUCK
+++ b/drivers/cisco/BUCK
@@ -1,19 +1,19 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-cisco'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//drivers/utilities:onos-drivers-utilities',
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'Cisco device drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Cisco device drivers application.',
+    required_apps = [ 'org.onosproject.netconf' ],
+)
diff --git a/drivers/default/BUCK b/drivers/default/BUCK
index 1491498..51f8552 100644
--- a/drivers/default/BUCK
+++ b/drivers/default/BUCK
@@ -1,9 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-default'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:openflowj',
@@ -12,24 +6,15 @@
     '//core/store/serializers:onos-core-serializers',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-osgi_jar(
-    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 = 'Default device drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Default device drivers application.',
 )
diff --git a/drivers/fujitsu/BUCK b/drivers/fujitsu/BUCK
index 38643b7..0ea201d 100644
--- a/drivers/fujitsu/BUCK
+++ b/drivers/fujitsu/BUCK
@@ -1,19 +1,19 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-fujitsu'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//drivers/utilities:onos-drivers-utilities',
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'Fujitsu device drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Fujitsu device drivers application.',
+    required_apps = [ 'org.onosproject.netconf' ],
+)
diff --git a/drivers/lumentum/BUCK b/drivers/lumentum/BUCK
index 6e90129..620195e 100644
--- a/drivers/lumentum/BUCK
+++ b/drivers/lumentum/BUCK
@@ -1,8 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-lumentum'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//lib:org.apache.servicemix.bundles.snmp4j',
@@ -11,11 +6,16 @@
     '//incubator/api:onos-incubator-api',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'Lumentum Device Drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS Lumentum Device Drivers application.',
+    required_apps = [ 'org.onosproject.snmp', 'org.onosproject.faultmanagement' ],
+)
diff --git a/drivers/netconf/BUCK b/drivers/netconf/BUCK
index 0ba3c5d..577d01e 100644
--- a/drivers/netconf/BUCK
+++ b/drivers/netconf/BUCK
@@ -1,19 +1,18 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-netconf'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//drivers/utilities:onos-drivers-utilities',
     '//protocols/netconf/api:onos-protocols-netconf-api',
 ]
 
-osgi_jar(
-    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/**']),
 )
+
+onos_app (
+    title = 'NETCONF Device Drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS NETCONF Device Drivers application.',
+)
diff --git a/drivers/ovsdb/BUCK b/drivers/ovsdb/BUCK
index d63c6b7..56d3dea 100644
--- a/drivers/ovsdb/BUCK
+++ b/drivers/ovsdb/BUCK
@@ -1,8 +1,3 @@
-SRC = 'src/main/java/org/onosproject/**/'
-
-CURRENT_NAME = 'onos-drivers-ovsdb'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//drivers/utilities:onos-drivers-utilities',
@@ -10,11 +5,21 @@
     '//protocols/ovsdb/rfc:onos-ovsdb-rfc',
 ]
 
-osgi_jar(
-    name = CURRENT_NAME,
-    srcs = glob([SRC + '/*.java']),
+TEST_DEPS = [
+    '//lib:TEST_ADAPTERS',
+    '//protocols/ovsdb/api:onos-protocols-ovsdb-tests',
+]
+
+osgi_jar_with_tests (
     deps = COMPILE_DEPS,
-    visibility = ['PUBLIC'],
+    test_deps = TEST_DEPS,
     resources_root = 'src/main/resources',
     resources = glob(['src/main/resources/**']),
 )
+
+onos_app (
+    title = 'OVSDB Device Drivers',
+    category = 'Drivers',
+    url = 'http://onosproject.org',
+    description = 'ONOS OVSDB Device Drivers application.',
+)
diff --git a/drivers/utilities/BUCK b/drivers/utilities/BUCK
index 80ec633..731ad13 100644
--- a/drivers/utilities/BUCK
+++ b/drivers/utilities/BUCK
@@ -1,34 +1,11 @@
-SRC = 'src/main/java/org/onosproject/**/'
-TEST = 'src/test/java/org/onosproject/**/'
-CURRENT_NAME = 'onos-drivers-utilities'
-CURRENT_TARGET = ':' + CURRENT_NAME
-
 COMPILE_DEPS = [
     '//lib:CORE_DEPS',
     '//core/net:onos-core-net',
 ]
 
-TEST_DEPS = [
-    '//lib:TEST',
-]
-
-osgi_jar(
-    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 = 'onos-drivers-utilities-tests',
-    visibility = ['PUBLIC'],
-    resources_root = 'src/test/resources',
-    resources = glob(['src/test/resources/**']),
-    srcs = glob([TEST + '/*.java']),
-    deps = COMPILE_DEPS +
-           TEST_DEPS +
-           [CURRENT_TARGET],
-    source_under_test = [CURRENT_TARGET],
-)