Initial BUCK build

Change-Id: I64e8a979301989062f4545a4841b06c15a372049
diff --git a/apps/aaa/BUCK b/apps/aaa/BUCK
new file mode 100644
index 0000000..160c420
--- /dev/null
+++ b/apps/aaa/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-aaa'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/acl/BUCK b/apps/acl/BUCK
new file mode 100644
index 0000000..72f4eb4
--- /dev/null
+++ b/apps/acl/BUCK
@@ -0,0 +1,32 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-acl'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:javax.ws.rs-api',
+    '//utils/rest:onlab-rest',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/bgprouter/BUCK b/apps/bgprouter/BUCK
new file mode 100644
index 0000000..dcf4c8b
--- /dev/null
+++ b/apps/bgprouter/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-bgprouter'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-app-routing-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/cip/BUCK b/apps/cip/BUCK
new file mode 100644
index 0000000..dbaa33b
--- /dev/null
+++ b/apps/cip/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-cip'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/cordmcast/BUCK b/apps/cordmcast/BUCK
new file mode 100644
index 0000000..0b61f99
--- /dev/null
+++ b/apps/cordmcast/BUCK
@@ -0,0 +1,34 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/cordvtn/BUCK b/apps/cordvtn/BUCK
new file mode 100644
index 0000000..5ceb313
--- /dev/null
+++ b/apps/cordvtn/BUCK
@@ -0,0 +1,41 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-cordvtn'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:javax.ws.rs-api',
+    '//lib:jsch',
+    '//utils/rest:onlab-rest',
+    '//cli:onos-cli',
+    '//core/store/serializers:onos-core-serializers',
+    '//apps/openstackinterface:onos-app-openstackinterface-api',
+    '//apps/dhcp/api:onos-app-dhcp-api',
+    '//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']),
+    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],
+)
diff --git a/apps/cpman/api/BUCK b/apps/cpman/api/BUCK
new file mode 100644
index 0000000..1d410b0
--- /dev/null
+++ b/apps/cpman/api/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-cpman-api'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+ ]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/cpman/app/BUCK b/apps/cpman/app/BUCK
new file mode 100644
index 0000000..b42d086
--- /dev/null
+++ b/apps/cpman/app/BUCK
@@ -0,0 +1,35 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-cpman-app'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:javax.ws.rs-api',
+    '//lib:rrd4j',
+    '//apps/cpman/api:onos-app-cpman-api',
+    '//utils/rest:onlab-rest',
+    '//cli:onos-cli',
+ ]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/dhcp/api/BUCK b/apps/dhcp/api/BUCK
new file mode 100644
index 0000000..eaa368b
--- /dev/null
+++ b/apps/dhcp/api/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-dhcp-api'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/dhcp/app/BUCK b/apps/dhcp/app/BUCK
new file mode 100644
index 0000000..e11bea9
--- /dev/null
+++ b/apps/dhcp/app/BUCK
@@ -0,0 +1,35 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-dhcp-app'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:javax.ws.rs-api',
+    '//lib:org.apache.karaf.shell.console',
+    '//apps/dhcp/api:onos-app-dhcp-api',
+    '//utils/rest:onlab-rest',
+    '//core/store/serializers:onos-core-serializers',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/drivermatrix/BUCK b/apps/drivermatrix/BUCK
new file mode 100644
index 0000000..d8ac3bb
--- /dev/null
+++ b/apps/drivermatrix/BUCK
@@ -0,0 +1,33 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-drivermatrix'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/events/BUCK b/apps/events/BUCK
new file mode 100644
index 0000000..e3ec6cf
--- /dev/null
+++ b/apps/events/BUCK
@@ -0,0 +1,33 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-events'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/faultmanagement/BUCK b/apps/faultmanagement/BUCK
new file mode 100644
index 0000000..7dd4252
--- /dev/null
+++ b/apps/faultmanagement/BUCK
@@ -0,0 +1,91 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//incubator/api:onos-incubator-api',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+   name = 'onos-app-fm',
+   visibility = ['PUBLIC'],
+   deps = [':fmcli', ':fmgui', ':fmmgr', ':fmweb'],
+)
+
+java_library(
+    name = 'fmcli',
+    srcs = glob(['fmcli/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+    resources_root = 'fmcli/src/main/resources',
+    resources = glob(['fmcli/src/main/resources/**']),
+)
+
+java_test(
+    name = 'fmcli-tests',
+    srcs = glob(['fmcli/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':fmcli'],
+    source_under_test = [':fmcli'],
+)
+
+java_library(
+    name = 'fmgui',
+    srcs = glob(['fmgui/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+    resources_root = 'fmgui/src/main/resources',
+    resources = glob(['fmgui/src/main/resources/**']),
+)
+
+java_test(
+    name = 'fmgui-tests',
+    srcs = glob(['fmgui/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':fmgui'],
+    source_under_test = [':fmgui'],
+)
+
+java_library(
+    name = 'fmmgr',
+    srcs = glob(['fmmgr/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'fmmgr-tests',
+    srcs = glob(['fmmgr/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':fmmgr'],
+    source_under_test = [':fmmgr'],
+)
+
+java_library(
+    name = 'fmweb',
+    srcs = glob(['fmweb/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'fmweb-tests',
+    srcs = glob(['fmweb/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':fmweb'],
+    source_under_test = [':fmweb'],
+    resources_root = 'fmweb/src/test/resources',
+    resources = glob(['fmweb/src/test/resources/**']),
+)
diff --git a/apps/flowanalyzer/BUCK b/apps/flowanalyzer/BUCK
new file mode 100644
index 0000000..e377f7c
--- /dev/null
+++ b/apps/flowanalyzer/BUCK
@@ -0,0 +1,33 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-flowanalyzer'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/fwd/BUCK b/apps/fwd/BUCK
new file mode 100644
index 0000000..62529ce
--- /dev/null
+++ b/apps/fwd/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-fwd'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/igmp/BUCK b/apps/igmp/BUCK
new file mode 100644
index 0000000..c298964
--- /dev/null
+++ b/apps/igmp/BUCK
@@ -0,0 +1,32 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/influxdbmetrics/BUCK b/apps/influxdbmetrics/BUCK
new file mode 100644
index 0000000..0847bb7
--- /dev/null
+++ b/apps/influxdbmetrics/BUCK
@@ -0,0 +1,33 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-influxdb'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:metrics-influxdb',
+    '//lib:influxdb-java',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/iptopology-api/BUCK b/apps/iptopology-api/BUCK
new file mode 100644
index 0000000..79a4146
--- /dev/null
+++ b/apps/iptopology-api/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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
new file mode 100644
index 0000000..ad1b452
--- /dev/null
+++ b/apps/metrics/BUCK
@@ -0,0 +1,35 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-metrics'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:javax.ws.rs-api',
+    '//utils/rest:onlab-rest',
+    '//cli:onos-cli',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/metricsreporter/BUCK b/apps/metricsreporter/BUCK
new file mode 100644
index 0000000..9a2fa1c
--- /dev/null
+++ b/apps/metricsreporter/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-metrics-reporter'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:gmetric4j',
+    '//lib:metrics-ganglia',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/mfwd/BUCK b/apps/mfwd/BUCK
new file mode 100644
index 0000000..46730ef
--- /dev/null
+++ b/apps/mfwd/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/mlb/BUCK b/apps/mlb/BUCK
new file mode 100644
index 0000000..dc45bb0
--- /dev/null
+++ b/apps/mlb/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/mobility/BUCK b/apps/mobility/BUCK
new file mode 100644
index 0000000..4adca9f
--- /dev/null
+++ b/apps/mobility/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/olt/BUCK b/apps/olt/BUCK
new file mode 100644
index 0000000..a626006
--- /dev/null
+++ b/apps/olt/BUCK
@@ -0,0 +1,48 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:javax.ws.rs-api',
+    '//lib:jersey-client',
+    '//lib:org.apache.karaf.shell.console',
+    '//utils/rest:onlab-rest',
+    '//cli:onos-cli',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = 'onos-app-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',
+    srcs = glob(['app/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-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'],
+)
diff --git a/apps/openstackinterface/BUCK b/apps/openstackinterface/BUCK
new file mode 100644
index 0000000..a43ca84
--- /dev/null
+++ b/apps/openstackinterface/BUCK
@@ -0,0 +1,44 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:jersey-client',
+    '//lib:javax.ws.rs-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = 'onos-app-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'],
+)
+
+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'],
+)
diff --git a/apps/openstacknetworking/BUCK b/apps/openstacknetworking/BUCK
new file mode 100644
index 0000000..65b6acc
--- /dev/null
+++ b/apps/openstacknetworking/BUCK
@@ -0,0 +1,102 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:jersey-client',
+    '//lib:javax.ws.rs-api',
+    '//apps/openstackinterface:onos-app-openstackinterface-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+java_library(
+   name = 'onos-app-openstacknetworking',
+   visibility = ['PUBLIC'],
+   deps = [
+       ':onos-app-openstacknetworking-api',
+       ':onos-app-openstacknetworking-app',
+       ':onos-app-openstackrouting',
+       ':onos-app-openstackswitching',
+       ':onos-app-openstacknetworking-web',
+   ]
+)
+
+TEST_DEPS = [
+    '//lib:TEST',
+    ':onos-app-openstacknetworking',
+]
+
+java_library(
+    name = 'onos-app-openstacknetworking-api',
+    srcs = glob(['api/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-openstacknetworking-api-tests',
+    srcs = glob([TEST + 'api/*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS,
+    source_under_test = [':onos-app-openstacknetworking-api'],
+)
+
+java_library(
+    name = 'onos-app-openstacknetworking-app',
+    srcs = glob(['app/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-openstacknetworking-api'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-openstacknetworking-app-tests',
+    srcs = glob([TEST + 'app/*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS,
+    source_under_test = [':onos-app-openstacknetworking-app'],
+)
+
+java_library(
+    name = 'onos-app-openstackrouting',
+    srcs = glob(['openstackrouting/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-openstacknetworking-api'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-openstackrouting-tests',
+    srcs = glob([TEST + 'openstackrouting/*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS,
+    source_under_test = [':onos-app-openstackrouting'],
+)
+
+java_library(
+    name = 'onos-app-openstackswitching',
+    srcs = glob(['openstgackswitching/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-openstacknetworking-api'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-openstackswitching-tests',
+    srcs = glob([TEST + 'openstackswitching/*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS,
+    source_under_test = [':onos-app-openstackswitching'],
+)
+
+java_library(
+    name = 'onos-app-openstacknetworking-web',
+    srcs = glob(['openstgacknetworking/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-openstacknetworking-api'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-openstacknetworking-web-tests',
+    srcs = glob([TEST + 'openstackswitching/*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS,
+    source_under_test = [':onos-app-openstacknetworking-web'],
+)
diff --git a/apps/openstacknode/BUCK b/apps/openstacknode/BUCK
new file mode 100644
index 0000000..856dc7e
--- /dev/null
+++ b/apps/openstacknode/BUCK
@@ -0,0 +1,32 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-openstacknode'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//protocols/ovsdb/api:onos-ovsdb-api',
+    '//protocols/ovsdb/rfc:onos-ovsdb-rfc',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/optical/BUCK b/apps/optical/BUCK
new file mode 100644
index 0000000..33a5615
--- /dev/null
+++ b/apps/optical/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/pathpainter/BUCK b/apps/pathpainter/BUCK
new file mode 100644
index 0000000..99cbcb6
--- /dev/null
+++ b/apps/pathpainter/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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],
+)
diff --git a/apps/pcep-api/BUCK b/apps/pcep-api/BUCK
new file mode 100644
index 0000000..4b78c47
--- /dev/null
+++ b/apps/pcep-api/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/pim/BUCK b/apps/pim/BUCK
new file mode 100644
index 0000000..5a1c074
--- /dev/null
+++ b/apps/pim/BUCK
@@ -0,0 +1,35 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-pim'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-app-routing-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/proxyarp/BUCK b/apps/proxyarp/BUCK
new file mode 100644
index 0000000..8c7328e
--- /dev/null
+++ b/apps/proxyarp/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-proxyarp'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/routing-api/BUCK b/apps/routing-api/BUCK
new file mode 100644
index 0000000..26c30ad
--- /dev/null
+++ b/apps/routing-api/BUCK
@@ -0,0 +1,29 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-routing-api'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/routing/BUCK b/apps/routing/BUCK
new file mode 100644
index 0000000..7523af9
--- /dev/null
+++ b/apps/routing/BUCK
@@ -0,0 +1,37 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-routing'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:concurrent-trees',
+    '//cli:onos-cli',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-app-routing-api',
+    '//core/common:onos-core-common',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/sdnip/BUCK b/apps/sdnip/BUCK
new file mode 100644
index 0000000..450ab22
--- /dev/null
+++ b/apps/sdnip/BUCK
@@ -0,0 +1,31 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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-app-routing-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/segmentrouting/BUCK b/apps/segmentrouting/BUCK
new file mode 100644
index 0000000..3ed2a55
--- /dev/null
+++ b/apps/segmentrouting/BUCK
@@ -0,0 +1,38 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-segmentrouting'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//lib:javax.ws.rs-api',
+    '//cli:onos-cli',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-app-routing-api',
+    '//utils/rest:onlab-rest',
+
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/test/BUCK b/apps/test/BUCK
new file mode 100644
index 0000000..a7cf25d
--- /dev/null
+++ b/apps/test/BUCK
@@ -0,0 +1,136 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+   name = 'onos-app-test',
+   visibility = ['PUBLIC'],
+   deps = [':onos-app-demo',
+           ':onos-app-distributed-primitives',
+           ':onos-app-election',
+           ':onos-app-intent-perf',
+           ':onos-app-loadtest',
+           ':onos-app-messaging-perf',
+   ],
+)
+
+# demo
+
+java_library(
+    name = 'onos-app-demo',
+    srcs = glob(['demo/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-demo-tests',
+    srcs = glob(['demo/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-demo'],
+    source_under_test = [':onos-app-demo'],
+)
+
+# distributed-primitives
+
+java_library(
+    name = 'onos-app-distributed-primitives',
+    srcs = glob(['distributed-primitives/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-distributed-primitives-tests',
+    srcs = glob(['distributed-primitives/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-distributed-primitives'],
+    source_under_test = [':onos-app-distributed-primitives'],
+)
+
+# election
+
+java_library(
+    name = 'onos-app-election',
+    srcs = glob(['election/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-election-tests',
+    srcs = glob(['election/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-election'],
+    source_under_test = [':onos-app-election'],
+)
+
+# intent-perf
+
+java_library(
+    name = 'onos-app-intent-perf',
+    srcs = glob(['intent-perf/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-intent-perf-tests',
+    srcs = glob(['intent-perf/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-intent-perf'],
+    source_under_test = [':onos-app-intent-perf'],
+)
+
+# loadtest
+
+java_library(
+    name = 'onos-app-loadtest',
+    srcs = glob(['loadtest/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-loadtest-tests',
+    srcs = glob(['loadtest/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-loadtest'],
+    source_under_test = [':onos-app-loadtest'],
+)
+
+# messaging-perf
+
+java_library(
+    name = 'onos-app-messaging-perf',
+    srcs = glob(['messaging-perf/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-messaging-perf-tests',
+    srcs = glob(['messaging-perf/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-messaging-perf'],
+    source_under_test = [':onos-app-messaging-perf'],
+)
+
diff --git a/apps/virtualbng/BUCK b/apps/virtualbng/BUCK
new file mode 100644
index 0000000..b453226
--- /dev/null
+++ b/apps/virtualbng/BUCK
@@ -0,0 +1,36 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-virtualbng'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:jersey-client',
+    '//lib:javax.ws.rs-api',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)
diff --git a/apps/vpls/BUCK b/apps/vpls/BUCK
new file mode 100644
index 0000000..f9c88b3
--- /dev/null
+++ b/apps/vpls/BUCK
@@ -0,0 +1,36 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-vpls'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:jersey-client',
+    '//lib:javax.ws.rs-api',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//incubator/api:onos-incubator-api',
+    '//apps/routing-api:onos-app-routing-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    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],
+)
diff --git a/apps/vrouter/BUCK b/apps/vrouter/BUCK
new file mode 100644
index 0000000..b94198a
--- /dev/null
+++ b/apps/vrouter/BUCK
@@ -0,0 +1,30 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/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']),
+    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/vtn/BUCK b/apps/vtn/BUCK
new file mode 100644
index 0000000..e653036
--- /dev/null
+++ b/apps/vtn/BUCK
@@ -0,0 +1,104 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+    '//lib:javax.ws.rs-api',
+    '//core/store/serializers:onos-core-serializers',
+    '//incubator/api:onos-incubator-api',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+   name = 'onos-app-vtn',
+   visibility = ['PUBLIC'],
+   deps = [':onos-app-sfc-mgr',
+           ':onos-app-vtn-mgr',
+           ':onos-app-vtn-rsc',
+           ':onos-app-vtn-web',
+   ],
+)
+
+# sfcmgr
+
+java_library(
+    name = 'onos-app-sfc-mgr',
+    srcs = glob(['sfcmgr/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-vtn-rsc'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-sfc-mgr-tests',
+    srcs = glob(['sfcmgr/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-sfc-mgr', ':onos-app-vtn-rsc'],
+    source_under_test = [':onos-app-sfc-mgr'],
+)
+
+# vtnmgr
+
+java_library(
+    name = 'onos-app-vtn-mgr',
+    srcs = glob(['vtnmgr/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-vtn-rsc'],
+    visibility = ['PUBLIC'],
+    resources_root = 'vtnmgr/src/main/resources',
+    resources = glob(['vtnmgr/src/main/resources/**']),
+)
+
+java_test(
+    name = 'onos-app-vtn-mgr-tests',
+    srcs = glob(['vtnmgr/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-vtn-mgr', ':onos-app-vtn-rsc'],
+    source_under_test = [':onos-app-vtn-mgr'],
+)
+
+# vtnrsc
+
+java_library(
+    name = 'onos-app-vtn-rsc',
+    srcs = glob(['vtnrsc/' + SRC + '*.java']),
+    deps = COMPILE_DEPS,
+    visibility = ['PUBLIC'],
+    resources_root = 'vtnrsc/src/main/resources',
+    resources = glob(['vtnrsc/src/main/resources/**']),
+)
+
+java_test(
+    name = 'onos-app-vtn-rsc-tests',
+    srcs = glob(['vtnrsc/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-vtn-rsc'],
+    source_under_test = [':onos-app-vtn-rsc'],
+)
+
+# vtnweb
+
+java_library(
+    name = 'onos-app-vtn-web',
+    srcs = glob(['vtnweb/' + SRC + '*.java']),
+    deps = COMPILE_DEPS + [':onos-app-vtn-rsc'],
+    visibility = ['PUBLIC'],
+)
+
+java_test(
+    name = 'onos-app-vtn-web-tests',
+    srcs = glob(['vtnweb/' + TEST + '*.java']),
+    deps = COMPILE_DEPS +
+           TEST_DEPS +
+           [':onos-app-vtn-web', ':onos-app-vtn-rsc'],
+    source_under_test = [':onos-app-vtn-web'],
+    resources_root = 'vtnweb/src/test/resources',
+    resources = glob(['vtnweb/src/test/resources/**']),
+)
diff --git a/apps/xos-integration/BUCK b/apps/xos-integration/BUCK
new file mode 100644
index 0000000..1413d0f
--- /dev/null
+++ b/apps/xos-integration/BUCK
@@ -0,0 +1,36 @@
+SRC = 'src/main/java/org/onosproject/**/'
+TEST = 'src/main/java/org/onosproject/**/'
+
+CURRENT_NAME = 'onos-app-xos-integration'
+CURRENT_TARGET = ':' + CURRENT_NAME
+
+COMPILE_DEPS = [
+    '//lib:CORE_DEPS',
+    '//lib:jersey-client',
+    '//lib:javax.ws.rs-api',
+    '//lib:org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+    '//utils/rest:onlab-rest',
+]
+
+TEST_DEPS = [
+    '//lib:TEST',
+]
+
+java_library(
+    name = CURRENT_NAME,
+    srcs = glob([SRC + '/*.java']),
+    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],
+)