Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 1 | load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar") |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 2 | load("//tools/build/bazel:variables.bzl", "GRPC_JAVA_VERSION") |
| 3 | load("//tools/build/bazel:variables.bzl", "PROTOBUF_VERSION") |
Carmelo Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 4 | |
| 5 | BUNDLES = [ |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 6 | "//protocols/grpc/proto:onos-protocols-grpc-proto", |
Carmelo Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 7 | "//protocols/grpc/api:onos-protocols-grpc-api", |
| 8 | "//protocols/grpc/ctl:onos-protocols-grpc-ctl", |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 9 | # gRPC dependencies (with patched core) |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 10 | ":grpc-core", |
| 11 | ":grpc-stub", |
| 12 | ":grpc-netty", |
| 13 | ":grpc-auth", |
| 14 | ":grpc-protobuf", |
| 15 | ":grpc-protobuf-lite", |
| 16 | ":protobuf-java", |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 17 | "@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 Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 23 | ] |
| 24 | |
Ray Milkey | 05d609a | 2018-08-15 10:27:58 -0700 | [diff] [blame] | 25 | onos_app( |
Carmelo Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 26 | app_name = "org.onosproject.protocols.grpc", |
Thomas Vachuska | d8e7795 | 2018-11-19 12:26:43 -0800 | [diff] [blame] | 27 | category = "Protocol", |
Carmelo Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 28 | description = "Exposes APIs to operate with gRPC channels", |
| 29 | included_bundles = BUNDLES, |
Ray Milkey | 05d609a | 2018-08-15 10:27:58 -0700 | [diff] [blame] | 30 | title = "gRPC Protocol Subsystem", |
| 31 | url = "ttp://onosproject.org", |
Carmelo Cascone | 72893b7 | 2018-08-09 00:59:06 -0700 | [diff] [blame] | 32 | ) |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 33 | |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 34 | # Wrap protobuf and grpc-related JARs in OSGi-compatible ones, since the |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 35 | # original ones are built with Bazel and NOT imported via mvn. |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 36 | |
| 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 Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 41 | GRPC_GROUP_ID = "io.grpc" |
| 42 | |
| 43 | PROTOBUF_GROUP_ID = "com.google.protobuf" |
| 44 | |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 45 | wrapped_osgi_jar( |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 46 | # 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 Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 52 | name = "grpc-core", |
| 53 | group = GRPC_GROUP_ID, |
Ray Milkey | 05d609a | 2018-08-15 10:27:58 -0700 | [diff] [blame] | 54 | jar = "@io_grpc_grpc_java//core", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 55 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 56 | visibility = ["//visibility:public"], |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 57 | deps = [], |
| 58 | ) |
| 59 | |
| 60 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 61 | name = "grpc-stub", |
| 62 | group = GRPC_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 63 | jar = "@io_grpc_grpc_java//stub", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 64 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 65 | visibility = ["//visibility:public"], |
| 66 | deps = [], |
| 67 | ) |
| 68 | |
| 69 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 70 | name = "grpc-netty", |
| 71 | group = GRPC_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 72 | jar = "@io_grpc_grpc_java//netty", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 73 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 74 | visibility = ["//visibility:public"], |
| 75 | deps = [], |
| 76 | ) |
| 77 | |
| 78 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 79 | name = "grpc-auth", |
| 80 | group = GRPC_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 81 | jar = "@io_grpc_grpc_java//auth", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 82 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 83 | visibility = ["//visibility:public"], |
| 84 | deps = [], |
| 85 | ) |
| 86 | |
| 87 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 88 | name = "grpc-protobuf", |
| 89 | group = GRPC_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 90 | jar = "@io_grpc_grpc_java//protobuf", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 91 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 92 | visibility = ["//visibility:public"], |
| 93 | deps = [], |
| 94 | ) |
| 95 | |
| 96 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 97 | name = "grpc-protobuf-lite", |
| 98 | group = GRPC_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 99 | jar = "@io_grpc_grpc_java//protobuf-lite", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 100 | version = GRPC_JAVA_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 101 | visibility = ["//visibility:public"], |
| 102 | deps = [], |
| 103 | ) |
| 104 | |
| 105 | wrapped_osgi_jar( |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 106 | name = "protobuf-java", |
| 107 | group = PROTOBUF_GROUP_ID, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 108 | jar = "@com_google_protobuf//:protobuf_java", |
Carmelo Cascone | bde9beb | 2019-02-08 14:40:56 -0800 | [diff] [blame] | 109 | version = PROTOBUF_VERSION, |
Carmelo Cascone | 0f8b7be | 2019-01-29 16:10:57 -0800 | [diff] [blame] | 110 | visibility = ["//visibility:public"], |
| 111 | deps = [], |
Carmelo Cascone | 6a1ae71 | 2018-08-10 12:19:47 -0700 | [diff] [blame] | 112 | ) |