Adding more Bazel BUILD files

- added defs for CLI and REST

Change-Id: I6ce2c5aac5fcdd265561d6aa2abba66f5556ff3a
diff --git a/apps/cip/BUILD b/apps/cip/BUILD
new file mode 100644
index 0000000..80cd90a
--- /dev/null
+++ b/apps/cip/BUILD
@@ -0,0 +1,10 @@
+osgi_jar_with_tests (
+    deps = CORE_DEPS,
+)
+
+onos_app (
+    category = "Utility",
+    description = "ONOS Cluster IP alias application.",
+    title = "Cluster IP Alias",
+    url = "http://onosproject.org",
+)
diff --git a/apps/dhcp/app/BUILD b/apps/dhcp/app/BUILD
index 5d1f800..a19dd53 100644
--- a/apps/dhcp/app/BUILD
+++ b/apps/dhcp/app/BUILD
@@ -1,10 +1,6 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
-    "@javax_ws_rs_api//jar",
-    "@org_apache_karaf_shell_console//jar",
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + REST + CLI + [
     "//apps/dhcp/api:onos-apps-dhcp-api",
-    "//utils/rest:onlab-rest",
     "//core/store/serializers:onos-core-serializers",
-    "//cli:onos-cli",
 ]
 
 osgi_jar_with_tests(
diff --git a/apps/faultmanagement/fmcli/BUILD b/apps/faultmanagement/fmcli/BUILD
index 98c61a8..a0ee3b8 100644
--- a/apps/faultmanagement/fmcli/BUILD
+++ b/apps/faultmanagement/fmcli/BUILD
@@ -1,8 +1,6 @@
-COMPILE_DEPS = CORE_DEPS + [
-    "@org_apache_karaf_shell_console//jar",
+COMPILE_DEPS = CORE_DEPS + CLI + [
     "//incubator/api:onos-incubator-api",
     "//apps/faultmanagement/fmmgr:onos-apps-faultmanagement-fmmgr",
-    "//cli:onos-cli",
 ]
 
 osgi_jar_with_tests(
diff --git a/apps/fwd/BUILD b/apps/fwd/BUILD
new file mode 100644
index 0000000..48b1eec
--- /dev/null
+++ b/apps/fwd/BUILD
@@ -0,0 +1,22 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + CLI + [
+    "//core/store/serializers:onos-core-serializers",
+    "//core/store/primitives:onos-core-primitives",
+]
+
+osgi_jar_with_tests(
+    deps = COMPILE_DEPS,
+)
+
+onos_app(
+    category = "Traffic Engineering",
+    description = "Provisions traffic between end-stations using hop-by-hop flow programming by " +
+        "intercepting packets for which there are currently no matching flow objectives on the " +
+        "data plane. The paths paved in this manner are short-lived, i.e. they expire a few " +
+        "seconds after the flow on whose behalf they were programmed stops.\n\n" +
+        "The application relies on the ONOS path service to compute the shortest paths. " +
+        "In the event of negative topology events (link loss, device disconnect, etc.), " +
+        "the application will proactively invalidate any paths that it had programmed to lead " +
+        "through the resources that are no longer available.",
+    title = "Reactive Forwarding",
+    url = "http://onosproject.org",
+)
diff --git a/apps/mappingmanagement/cli/BUILD b/apps/mappingmanagement/cli/BUILD
index 8677a84..2eddaff 100644
--- a/apps/mappingmanagement/cli/BUILD
+++ b/apps/mappingmanagement/cli/BUILD
@@ -1,9 +1,5 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + [
-    "@org_apache_karaf_shell_console//jar",
-    "@javax_ws_rs_api//jar",
+COMPILE_DEPS = CORE_DEPS + JACKSON + CLI + REST + [
     "//incubator/api:onos-incubator-api",
-    "//cli:onos-cli",
-    "//utils/rest:onlab-rest",
     "//apps/mappingmanagement/api:onos-apps-mappingmanagement-api",
     "//core/store/serializers:onos-core-serializers",
 ]
diff --git a/apps/mcast/cli/BUILD b/apps/mcast/cli/BUILD
index b0e12b5..e692c4c 100644
--- a/apps/mcast/cli/BUILD
+++ b/apps/mcast/cli/BUILD
@@ -1,8 +1,4 @@
-COMPILE_DEPS = CORE_DEPS + [
-    "@org_apache_karaf_shell_console//jar",
-    "@javax_ws_rs_api//jar",
-    "//cli:onos-cli",
-    "//utils/rest:onlab-rest",
+COMPILE_DEPS = CORE_DEPS + CLI + REST + [
     "//core/store/serializers:onos-core-serializers",
     "//apps/mcast/api:onos-apps-mcast-api",
 ]
diff --git a/apps/optical-model/BUILD b/apps/optical-model/BUILD
index f57c3b5..61a839b 100644
--- a/apps/optical-model/BUILD
+++ b/apps/optical-model/BUILD
@@ -1,9 +1,7 @@
 load("//tools/build/bazel:generate_workspace.bzl", "ONOS_VERSION")
 
-COMPILE_DEPS = CORE_DEPS + JACKSON + [
-    "@org_apache_karaf_shell_console//jar",
+COMPILE_DEPS = CORE_DEPS + JACKSON + CLI + [
     "//incubator/api:onos-incubator-api",
-    "//cli:onos-cli",
 ]
 
 osgi_jar_with_tests(
diff --git a/apps/pce/app/BUILD b/apps/pce/app/BUILD
index bdce3250..3bb7284 100644
--- a/apps/pce/app/BUILD
+++ b/apps/pce/app/BUILD
@@ -1,9 +1,5 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
-    "@org_apache_karaf_shell_console//jar",
-    "@javax_ws_rs_api//jar",
-    "//cli:onos-cli",
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + REST + [
     "//core/store/serializers:onos-core-serializers",
-    "//utils/rest:onlab-rest",
     "//incubator/api:onos-incubator-api",
     "//apps/pcep-api:onos-apps-pcep-api",
     "//apps/pce/bandwidthmgmt:onos-apps-pce-bandwidthmgmt",
diff --git a/apps/pce/pceweb/BUILD b/apps/pce/pceweb/BUILD
index 853f9b3..bd9f299 100644
--- a/apps/pce/pceweb/BUILD
+++ b/apps/pce/pceweb/BUILD
@@ -1,7 +1,5 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + [
-    "@org_apache_karaf_shell_console//jar",
+COMPILE_DEPS = CORE_DEPS + JACKSON + CLI + [
     "//apps/pce/app:onos-apps-pce-app",
-    "//cli:onos-cli",
     "//incubator/api:onos-incubator-api",
 ]
 
diff --git a/apps/route-service/app/BUILD b/apps/route-service/app/BUILD
index 2fe269e..4eb3fe3 100644
--- a/apps/route-service/app/BUILD
+++ b/apps/route-service/app/BUILD
@@ -1,12 +1,8 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
-    "@org_apache_karaf_shell_console//jar",
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + REST + [
     "@concurrent_trees//jar",
-    "@javax_ws_rs_api//jar",
     "@jersey_server//jar",
     "//core/store/serializers:onos-core-serializers",
     "//apps/route-service/api:onos-apps-route-service-api",
-    "//cli:onos-cli",
-    "//utils/rest:onlab-rest",
 ]
 
 TEST_DEPS = TEST + [
diff --git a/apps/segmentrouting/app/BUILD b/apps/segmentrouting/app/BUILD
index c54c662..9edce3e 100644
--- a/apps/segmentrouting/app/BUILD
+++ b/apps/segmentrouting/app/BUILD
@@ -1,6 +1,4 @@
-COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + [
-    "@org_apache_karaf_shell_console//jar",
-    "//cli:onos-cli",
+COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [
     "//core/common:onos-core-common",
     "//core/store/serializers:onos-core-serializers",
     "//incubator/api:onos-incubator-api",
diff --git a/lib/BUCK b/lib/BUCK
index 85a235f..2e3302b 100644
--- a/lib/BUCK
+++ b/lib/BUCK
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Mon, 2 Jul 2018 20:10:43 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Wed, 11 Jul 2018 05:19:09 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 pass_thru_pom(
@@ -178,6 +178,24 @@
   ],
 )
 
+osgi_feature_group(
+  name = 'CLI',
+  visibility = ['PUBLIC'],
+  exported_deps = [
+    ':org.apache.karaf.shell.console',
+    '//cli:onos-cli',
+  ],
+)
+
+osgi_feature_group(
+  name = 'REST',
+  visibility = ['PUBLIC'],
+  exported_deps = [
+    ':javax.ws.rs-api',
+    '//utils/rest:onlab-rest',
+  ],
+)
+
 remote_jar (
   name = 'aopalliance-repackaged',
   out = 'aopalliance-repackaged-2.5.0-b42.jar',
diff --git a/lib/deps.json b/lib/deps.json
index cbf30ed..fb4b3db 100644
--- a/lib/deps.json
+++ b/lib/deps.json
@@ -109,6 +109,14 @@
       "asm",
       "minlog",
       "objenesis"
+    ],
+    "CLI": [
+      "org.apache.karaf.shell.console",
+      "//cli:onos-cli"
+    ],
+    "REST": [
+      "javax.ws.rs-api",
+      "//utils/rest:onlab-rest"
     ]
   },
 
diff --git a/modules.bzl b/modules.bzl
index 691c972..483290d 100644
--- a/modules.bzl
+++ b/modules.bzl
@@ -148,11 +148,11 @@
     # Apps
     "//apps/dhcp:onos-apps-dhcp-oar",
     #"//apps/dhcprelay:onos-apps-dhcprelay-oar",
-    #"//apps/fwd:onos-apps-fwd-oar",
+    "//apps/fwd:onos-apps-fwd-oar",
     #"//apps/packet-stats:onos-apps-packet-stats-oar",
     "//apps/acl:onos-apps-acl-oar",
     #"//apps/bgprouter:onos-apps-bgprouter-oar",
-    #"//apps/cip:onos-apps-cip-oar",
+    "//apps/cip:onos-apps-cip-oar",
     #"//apps/drivermatrix:onos-apps-drivermatrix-oar",
     #"//apps/events:onos-apps-events-oar",
     #"//apps/proxyarp:onos-apps-proxyarp-oar",
@@ -284,7 +284,7 @@
     #"//apps/imr/api:onos-apps-imr-api",
     #"//apps/imr/app:onos-apps-imr-app",
     #"//apps/dhcprelay:onos-apps-dhcprelay",
-    #"//apps/fwd:onos-apps-fwd",
+    "//apps/fwd:onos-apps-fwd",
     #"//apps/iptopology-api:onos-apps-iptopology-api",
     #"//apps/routing/common:onos-apps-routing-common",
     #"//apps/vtn/vtnrsc:onos-apps-vtn-vtnrsc",
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index c06aa22..0e7c50f 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Mon, 2 Jul 2018 20:10:47 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Wed, 11 Jul 2018 05:19:34 GMT. Do not edit this file manually. *****
 # ***** Use onos-lib-gen *****
 
 load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION")
@@ -110,6 +110,14 @@
     "@minlog//jar",
     "@objenesis//jar",
 ]
+CLI = [
+    "@org_apache_karaf_shell_console//jar",
+    "//cli:onos-cli",
+]
+REST = [
+    "@javax_ws_rs_api//jar",
+    "//utils/rest:onlab-rest",
+]
 
 def generated_maven_jars():
     native.maven_jar(
diff --git a/tools/build_rules/prelude_bazel b/tools/build_rules/prelude_bazel
index 8695c9a..842e116 100644
--- a/tools/build_rules/prelude_bazel
+++ b/tools/build_rules/prelude_bazel
@@ -5,6 +5,8 @@
     "GRPC_1_3",
     "JACKSON",
     "KRYO",
+    "CLI",
+    "REST",
     "METRICS",
     "NETTY",
     "TEST",