blob: f82e1f0a4a696e95ea88b43288a45bec6f7bc6c5 [file] [log] [blame]
Carmelo Cascone6a1ae712018-08-10 12:19:47 -07001load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar")
Carmelo Casconebde9beb2019-02-08 14:40:56 -08002load("//tools/build/bazel:variables.bzl", "GRPC_JAVA_VERSION")
3load("//tools/build/bazel:variables.bzl", "PROTOBUF_VERSION")
Carmelo Cascone72893b72018-08-09 00:59:06 -07004
5BUNDLES = [
Carmelo Cascone6a1ae712018-08-10 12:19:47 -07006 "//protocols/grpc/proto:onos-protocols-grpc-proto",
Carmelo Cascone72893b72018-08-09 00:59:06 -07007 "//protocols/grpc/api:onos-protocols-grpc-api",
8 "//protocols/grpc/ctl:onos-protocols-grpc-ctl",
Carmelo Cascone6a1ae712018-08-10 12:19:47 -07009 # gRPC dependencies (with patched core)
Carmelo Casconebde9beb2019-02-08 14:40:56 -080010 ":grpc-core",
11 ":grpc-stub",
12 ":grpc-netty",
13 ":grpc-auth",
14 ":grpc-protobuf",
15 ":grpc-protobuf-lite",
16 ":protobuf-java",
Carmelo Cascone6a1ae712018-08-10 12:19:47 -070017 "@com_google_api_grpc_proto_google_common_protos//jar",
18 "@com_google_errorprone_error_prone_annotations//jar",
19 "@com_google_auth_google_auth_library_credentials//jar",
20 "@io_opencensus_opencensus_api//jar",
21 "@io_opencensus_opencensus_contrib_grpc_metrics//jar",
22 "@com_google_code_gson_gson//jar",
Carmelo Cascone72893b72018-08-09 00:59:06 -070023]
24
Ray Milkey05d609a2018-08-15 10:27:58 -070025onos_app(
Carmelo Cascone72893b72018-08-09 00:59:06 -070026 app_name = "org.onosproject.protocols.grpc",
Thomas Vachuskad8e77952018-11-19 12:26:43 -080027 category = "Protocol",
Carmelo Cascone72893b72018-08-09 00:59:06 -070028 description = "Exposes APIs to operate with gRPC channels",
29 included_bundles = BUNDLES,
Ray Milkey05d609a2018-08-15 10:27:58 -070030 title = "gRPC Protocol Subsystem",
31 url = "ttp://onosproject.org",
Carmelo Cascone72893b72018-08-09 00:59:06 -070032)
Carmelo Cascone6a1ae712018-08-10 12:19:47 -070033
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080034# Wrap protobuf and grpc-related JARs in OSGi-compatible ones, since the
Carmelo Casconebde9beb2019-02-08 14:40:56 -080035# original ones are built with Bazel and NOT imported via mvn.
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080036
37# FIXME: consider moving these rules somewhere else as other apps depend on it
38# (e.g. openstacktelemetry and kafka-integration) but they don't directly
39# depend on any onos-protocols-grpc-* module.
40
Carmelo Casconebde9beb2019-02-08 14:40:56 -080041GRPC_GROUP_ID = "io.grpc"
42
43PROTOBUF_GROUP_ID = "com.google.protobuf"
44
Carmelo Cascone6a1ae712018-08-10 12:19:47 -070045wrapped_osgi_jar(
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080046 # Differently from the official "grpc-core" package, here we also include
47 # "grpc-context" to solve the OSGI split-brain problem:
48 # https://github.com/grpc/grpc-java/issues/2727
49 # We use patched Bazel BUILD files to package together core and context (see
50 # tools/build/bazel/grpc_workspace.bzl). If you need grpc-context as a
51 # compile-time dependency, please use this one.
Carmelo Casconebde9beb2019-02-08 14:40:56 -080052 name = "grpc-core",
53 group = GRPC_GROUP_ID,
Ray Milkey05d609a2018-08-15 10:27:58 -070054 jar = "@io_grpc_grpc_java//core",
Carmelo Casconebde9beb2019-02-08 14:40:56 -080055 version = GRPC_JAVA_VERSION,
Carmelo Cascone6a1ae712018-08-10 12:19:47 -070056 visibility = ["//visibility:public"],
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080057 deps = [],
58)
59
60wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -080061 name = "grpc-stub",
62 group = GRPC_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080063 jar = "@io_grpc_grpc_java//stub",
Carmelo Casconebde9beb2019-02-08 14:40:56 -080064 version = GRPC_JAVA_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080065 visibility = ["//visibility:public"],
66 deps = [],
67)
68
69wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -080070 name = "grpc-netty",
71 group = GRPC_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080072 jar = "@io_grpc_grpc_java//netty",
Carmelo Casconebde9beb2019-02-08 14:40:56 -080073 version = GRPC_JAVA_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080074 visibility = ["//visibility:public"],
75 deps = [],
76)
77
78wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -080079 name = "grpc-auth",
80 group = GRPC_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080081 jar = "@io_grpc_grpc_java//auth",
Carmelo Casconebde9beb2019-02-08 14:40:56 -080082 version = GRPC_JAVA_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080083 visibility = ["//visibility:public"],
84 deps = [],
85)
86
87wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -080088 name = "grpc-protobuf",
89 group = GRPC_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080090 jar = "@io_grpc_grpc_java//protobuf",
Carmelo Casconebde9beb2019-02-08 14:40:56 -080091 version = GRPC_JAVA_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080092 visibility = ["//visibility:public"],
93 deps = [],
94)
95
96wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -080097 name = "grpc-protobuf-lite",
98 group = GRPC_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -080099 jar = "@io_grpc_grpc_java//protobuf-lite",
Carmelo Casconebde9beb2019-02-08 14:40:56 -0800100 version = GRPC_JAVA_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -0800101 visibility = ["//visibility:public"],
102 deps = [],
103)
104
105wrapped_osgi_jar(
Carmelo Casconebde9beb2019-02-08 14:40:56 -0800106 name = "protobuf-java",
107 group = PROTOBUF_GROUP_ID,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -0800108 jar = "@com_google_protobuf//:protobuf_java",
Carmelo Casconebde9beb2019-02-08 14:40:56 -0800109 version = PROTOBUF_VERSION,
Carmelo Cascone0f8b7be2019-01-29 16:10:57 -0800110 visibility = ["//visibility:public"],
111 deps = [],
Carmelo Cascone6a1ae712018-08-10 12:19:47 -0700112)