Start on implementation of apps with multiple included bundles
Change-Id: I8fc8474d5f2ff1b45e0dccfbe3fc20e27cc9000b
diff --git a/apps/mcast/api/BUILD b/apps/mcast/api/BUILD
new file mode 100644
index 0000000..646cfb8
--- /dev/null
+++ b/apps/mcast/api/BUILD
@@ -0,0 +1,4 @@
+osgi_jar(
+ deps = CORE_DEPS,
+ visibility = ["//visibility:public"],
+)
diff --git a/apps/mcast/cli/BUILD b/apps/mcast/cli/BUILD
new file mode 100644
index 0000000..53d4c2c
--- /dev/null
+++ b/apps/mcast/cli/BUILD
@@ -0,0 +1,13 @@
+COMPILE_DEPS = CORE_DEPS + [
+ '@org_apache_karaf_shell_console//jar',
+ '@javax_ws_rs_api//jar',
+ '//cli:onos-cli',
+ '//utils/rest:onlab-rest',
+ '//core/store/serializers:onos-core-serializers',
+ '//apps/mcast/api:onos-apps-mcast-api',
+]
+
+osgi_jar(
+ deps = COMPILE_DEPS,
+ import_packages = '*,org.onosproject.cli.net',
+)
diff --git a/apps/mcast/impl/BUILD b/apps/mcast/impl/BUILD
new file mode 100644
index 0000000..539cac3
--- /dev/null
+++ b/apps/mcast/impl/BUILD
@@ -0,0 +1,8 @@
+COMPILE_DEPS = CORE_DEPS + KRYO + [
+ '//core/store/serializers:onos-core-serializers',
+ '//apps/mcast/api:onos-apps-mcast-api'
+]
+
+osgi_jar(
+ deps = COMPILE_DEPS,
+)
diff --git a/apps/mcast/web/BUILD b/apps/mcast/web/BUILD
new file mode 100644
index 0000000..7835ea3
--- /dev/null
+++ b/apps/mcast/web/BUILD
@@ -0,0 +1,14 @@
+COMPILE_DEPS = CORE_DEPS + JACKSON + [
+ '@javax_ws_rs_api//jar',
+ '//utils/rest:onlab-rest',
+ '//apps/mcast/api:onos-apps-mcast-api'
+]
+
+osgi_jar(
+ deps = COMPILE_DEPS,
+ web_context = '/onos/mcast',
+ api_title = 'Multicast API',
+ api_version = '1.0',
+ api_description = 'REST API for Multicast',
+ api_package = 'org.onosproject.mcast.web',
+)
diff --git a/tools/build/bazel/osgi_java_library.bzl b/tools/build/bazel/osgi_java_library.bzl
index de8c28c..8e4fb56 100644
--- a/tools/build/bazel/osgi_java_library.bzl
+++ b/tools/build/bazel/osgi_java_library.bzl
@@ -53,7 +53,7 @@
group = ctx.attr.package_name_root
version = ctx.attr.version
license = ""
- importPackages = "*"
+ import_packages = ctx.attr.import_packages
exportPackages = "*"
includeResources = ""
webContext = "NONE"
@@ -95,13 +95,14 @@
group,
version,
license,
- importPackages,
+ import_packages,
exportPackages,
includeResources,
webContext,
dynamicimportPackages,
classesPath,
]
+
ctx.actions.run(
inputs = inputDependencies,
outputs = [ctx.outputs.osgi_jar],
@@ -116,6 +117,7 @@
"version": attr.string(),
"package_name_root": attr.string(),
"source": attr.label(),
+ "import_packages": attr.string(),
"_bnd_exe": attr.label(
executable = True,
cfg = "host",
@@ -130,8 +132,8 @@
implementation = _bnd_impl,
)
-def wrapped_osgi_jar(name, jar, deps, version = ONOS_VERSION, package_name_root = "org.onosproject", visibility = ["//visibility:private"]):
- _bnd(name = name, source = jar, deps = deps, version = version, package_name_root = package_name_root, visibility = visibility)
+def wrapped_osgi_jar(name, jar, deps, version = ONOS_VERSION, package_name_root = "org.onosproject", import_packages = "*", visibility = ["//visibility:private"]):
+ _bnd(name = name, source = jar, deps = deps, version = version, package_name_root = package_name_root, visibility = visibility, import_packages = import_packages)
def osgi_jar_with_tests(
name = None,
@@ -145,7 +147,9 @@
exclude_tests = None,
test_resources = None,
visibility = ["//visibility:public"],
- version = ONOS_VERSION):
+ version = ONOS_VERSION,
+ import_packages = None,
+ ):
if name == None:
name = "onos-" + native.package_name().replace("/", "-")
if srcs == None:
@@ -162,6 +166,8 @@
deps = COMPILE
if test_deps == None:
test_deps = TEST
+ if import_packages == None:
+ import_packages = "*"
tests_name = name + "-tests"
tests_jar_deps = list(depset(deps + test_deps)) + [name]
all_test_deps = tests_jar_deps + [tests_name]
@@ -174,6 +180,7 @@
version = version,
package_name_root = package_name_root,
visibility = visibility,
+ import_packages = import_packages,
)
if test_srcs != []:
native.java_library(
@@ -194,12 +201,20 @@
def osgi_jar(
name = None,
deps = None,
+ import_packages = None,
package_name_root = "org.onosproject",
srcs = None,
resources_root = None,
resources = None,
visibility = ["//visibility:public"],
- version = ONOS_VERSION):
+ version = ONOS_VERSION,
+ # TODO - implement these for swagger and web.xml
+ web_context = "",
+ api_title = "",
+ api_version = "",
+ api_description = "",
+ api_package = "",
+ ):
if srcs == None:
srcs = _all_java_sources()
if deps == None:
@@ -218,4 +233,5 @@
test_resources = [],
visibility = visibility,
version = version,
+ import_packages = import_packages,
)