From c0b23a459f05253f13dbe5b08b17a8197b97f75c Mon Sep 17 00:00:00 2001 From: Carmelo Cascone Date: Thu, 25 Apr 2019 13:50:54 -0700 Subject: [PATCH] Allow building third-party apps based on gRPC By publishing the repackaged grpc and protobuf artifacts Change-Id: Ib3af7dba4f64948132aa70be31922de61d6f6ab2 --- apps/kafka-integration/BUILD | 2 +- apps/kafka-integration/app/BUILD | 2 +- apps/onlp-demo/BUILD | 8 +- apps/openstacktelemetry/BUILD | 14 ++-- apps/openstacktelemetry/app/BUILD | 4 +- drivers/bmv2/BUILD | 4 +- drivers/gnmi/BUILD | 8 +- drivers/gnoi/BUILD | 8 +- drivers/p4runtime/BUILD | 2 +- drivers/stratum/BUILD | 2 +- lib/BUILD | 66 ++++++++++++++++ protocols/gnmi/ctl/BUILD | 14 ++-- protocols/gnoi/ctl/BUILD | 14 ++-- protocols/grpc/BUILD | 98 ++---------------------- protocols/grpc/api/BUILD | 2 +- protocols/grpc/ctl/BUILD | 8 +- protocols/grpc/utils/BUILD | 2 +- protocols/p4runtime/api/BUILD | 2 +- protocols/p4runtime/ctl/BUILD | 14 ++-- protocols/p4runtime/model/BUILD | 2 +- providers/general/device/BUILD | 2 +- tools/build/bazel/grpc_workspace.bzl | 3 +- tools/build/bazel/osgi_java_library.bzl | 19 +++-- tools/build/bazel/protobuf_workspace.bzl | 2 +- tools/build/bazel/variables.bzl | 3 - tools/build/onos-publish-catalog | 12 ++- tools/build/publish-target-list | 5 ++ 27 files changed, 161 insertions(+), 161 deletions(-) create mode 100644 lib/BUILD diff --git a/apps/kafka-integration/BUILD b/apps/kafka-integration/BUILD index 62c12937e1..6daeb1a6ba 100644 --- a/apps/kafka-integration/BUILD +++ b/apps/kafka-integration/BUILD @@ -1,6 +1,6 @@ BUNDLES = [ "@kafka_clients//jar", - "//protocols/grpc:protobuf-java", + "//lib:com_google_protobuf_protobuf_java", "//core/protobuf/models:onos-core-protobuf-models", "//core/protobuf/models/proto:onos-core-protobuf-models-proto", "//apps/kafka-integration/api:onos-apps-kafka-integration-api", diff --git a/apps/kafka-integration/app/BUILD b/apps/kafka-integration/app/BUILD index 5d1f1ed147..4cf8eaadee 100644 --- a/apps/kafka-integration/app/BUILD +++ b/apps/kafka-integration/app/BUILD @@ -4,7 +4,7 @@ COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + [ "@kafka_clients//jar", "@javax_ws_rs_api//jar", "//utils/rest:onlab-rest", - "@com_google_protobuf//:protobuf_java", + "//lib:com_google_protobuf_protobuf_java", "//core/protobuf/models:onos-core-protobuf-models", "//core/protobuf/models/proto:onos-core-protobuf-models-proto", ] diff --git a/apps/onlp-demo/BUILD b/apps/onlp-demo/BUILD index 960a820b5b..2ef30c2131 100644 --- a/apps/onlp-demo/BUILD +++ b/apps/onlp-demo/BUILD @@ -1,8 +1,8 @@ COMPILE_DEPS = CORE_DEPS + JACKSON + [ - "@com_google_protobuf//:protobuf_java", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//stub", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_stub", "//core/store/serializers:onos-core-serializers", "//protocols/gnmi/stub:onos-protocols-gnmi-stub", "//protocols/gnmi/api:onos-protocols-gnmi-api", diff --git a/apps/openstacktelemetry/BUILD b/apps/openstacktelemetry/BUILD index 8e5007ab47..33b9813ef2 100644 --- a/apps/openstacktelemetry/BUILD +++ b/apps/openstacktelemetry/BUILD @@ -16,13 +16,13 @@ BUNDLES = [ "@simpleclient_hotspot//jar", "@simpleclient_servlet//jar", # gRPC dependencies (with patched core) - "//protocols/grpc:grpc-core", - "//protocols/grpc:grpc-stub", - "//protocols/grpc:grpc-netty", - "//protocols/grpc:grpc-auth", - "//protocols/grpc:grpc-protobuf", - "//protocols/grpc:grpc-protobuf-lite", - "//protocols/grpc:protobuf-java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_stub", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_auth", + "//lib:io_grpc_grpc_protobuf", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:com_google_protobuf_protobuf_java", "@com_google_api_grpc_proto_google_common_protos//jar", "@com_google_errorprone_error_prone_annotations//jar", "@com_google_auth_google_auth_library_credentials//jar", diff --git a/apps/openstacktelemetry/app/BUILD b/apps/openstacktelemetry/app/BUILD index e4422bc1c5..ecfb34d14d 100644 --- a/apps/openstacktelemetry/app/BUILD +++ b/apps/openstacktelemetry/app/BUILD @@ -12,8 +12,8 @@ COMPILE_DEPS = CORE_DEPS + JACKSON + KRYO + CLI + REST + [ "@jetty_util//jar", "@jetty_websocket//jar", "@servlet_api//jar", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//protobuf-lite", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_protobuf_lite", "//core/store/serializers:onos-core-serializers", "//apps/openstacknode/api:onos-apps-openstacknode-api", "//apps/openstacknetworking/api:onos-apps-openstacknetworking-api", diff --git a/drivers/bmv2/BUILD b/drivers/bmv2/BUILD index 5cf6f456ae..9478b50a5e 100644 --- a/drivers/bmv2/BUILD +++ b/drivers/bmv2/BUILD @@ -4,8 +4,8 @@ COMPILE_DEPS = CORE_DEPS + KRYO + JACKSON + [ "//pipelines/basic:onos-pipelines-basic", "//protocols/p4runtime/api:onos-protocols-p4runtime-api", "//protocols/p4runtime/model:onos-protocols-p4runtime-model", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//netty", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", "@minimal_json//jar", # "//protocols/bmv2/thrift-api:onos-protocols-bmv2-thrift-api", #"//lib:libthrift", diff --git a/drivers/gnmi/BUILD b/drivers/gnmi/BUILD index f01a9f3a24..f2c33d053c 100644 --- a/drivers/gnmi/BUILD +++ b/drivers/gnmi/BUILD @@ -1,8 +1,8 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ - "@com_google_protobuf//:protobuf_java", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//stub", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_stub", "//core/store/serializers:onos-core-serializers", "//protocols/gnmi/stub:onos-protocols-gnmi-stub", "//protocols/gnmi/api:onos-protocols-gnmi-api", diff --git a/drivers/gnoi/BUILD b/drivers/gnoi/BUILD index b5355a9f99..122c961d75 100644 --- a/drivers/gnoi/BUILD +++ b/drivers/gnoi/BUILD @@ -1,8 +1,8 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ - "@com_google_protobuf//:protobuf_java", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//stub", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_stub", "//protocols/gnoi/stub:onos-protocols-gnoi-stub", "//protocols/gnoi/api:onos-protocols-gnoi-api", "//protocols/grpc/api:onos-protocols-grpc-api", diff --git a/drivers/p4runtime/BUILD b/drivers/p4runtime/BUILD index f97dbd7b99..23c6e9e91a 100644 --- a/drivers/p4runtime/BUILD +++ b/drivers/p4runtime/BUILD @@ -3,7 +3,7 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ "//protocols/grpc/api:onos-protocols-grpc-api", "//protocols/grpc/utils:onos-protocols-grpc-utils", "//protocols/p4runtime/api:onos-protocols-p4runtime-api", - "@io_grpc_grpc_java//core", + "//lib:io_grpc_grpc_core_context", ] BUNDLES = [ diff --git a/drivers/stratum/BUILD b/drivers/stratum/BUILD index a87c97ef97..91b055c6c1 100644 --- a/drivers/stratum/BUILD +++ b/drivers/stratum/BUILD @@ -1,5 +1,5 @@ COMPILE_DEPS = CORE_DEPS + KRYO + JACKSON + [ - "@io_grpc_grpc_java//core", + "//lib:io_grpc_grpc_core_context", "//drivers/p4runtime:onos-drivers-p4runtime", "//drivers/gnmi:onos-drivers-gnmi", "//drivers/gnoi:onos-drivers-gnoi", diff --git a/lib/BUILD b/lib/BUILD new file mode 100644 index 0000000000..52c4ea69f4 --- /dev/null +++ b/lib/BUILD @@ -0,0 +1,66 @@ +load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar") + +# Wrap protobuf and grpc-related JARs in OSGi-compatible ones, since the +# original ones are built with Bazel and NOT imported via mvn. + +wrapped_osgi_jar( + # Differently from the official "grpc-core" package, here we also include + # "grpc-context" to solve the OSGI split-brain problem: + # https://github.com/grpc/grpc-java/issues/2727 + # We use patched Bazel BUILD files to package together core and context (see + # tools/build/bazel/grpc_workspace.bzl). If you need grpc-context as a + # compile-time dependency, please use this one. + name = "io_grpc_grpc_core_context", + generate_pom = True, + jar = "@io_grpc_grpc_java//core", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "io_grpc_grpc_stub", + generate_pom = True, + jar = "@io_grpc_grpc_java//stub", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "io_grpc_grpc_netty", + generate_pom = True, + jar = "@io_grpc_grpc_java//netty", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "io_grpc_grpc_auth", + generate_pom = True, + jar = "@io_grpc_grpc_java//auth", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "io_grpc_grpc_protobuf", + generate_pom = True, + jar = "@io_grpc_grpc_java//protobuf", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "io_grpc_grpc_protobuf_lite", + generate_pom = True, + jar = "@io_grpc_grpc_java//protobuf-lite", + visibility = ["//visibility:public"], + deps = [], +) + +wrapped_osgi_jar( + name = "com_google_protobuf_protobuf_java", + generate_pom = True, + jar = "@com_google_protobuf//:protobuf_java", + visibility = ["//visibility:public"], + deps = [], +) diff --git a/protocols/gnmi/ctl/BUILD b/protocols/gnmi/ctl/BUILD index e12a8ce453..482a37fa7f 100644 --- a/protocols/gnmi/ctl/BUILD +++ b/protocols/gnmi/ctl/BUILD @@ -3,18 +3,18 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ "//protocols/gnmi/stub:onos-protocols-gnmi-stub", "//protocols/grpc/api:onos-protocols-grpc-api", "//protocols/grpc/ctl:onos-protocols-grpc-ctl", - "//protocols/grpc:grpc-core", - "@com_google_protobuf//:protobuf_java", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//protobuf-lite", - "@io_grpc_grpc_java//stub", + "//lib:io_grpc_grpc_core_context", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:io_grpc_grpc_stub", "@com_google_api_grpc_proto_google_common_protos//jar", ] TEST_DEPS = TEST + [ "@minimal_json//jar", - "@io_grpc_grpc_java//core:inprocess", - "@io_grpc_grpc_java//protobuf-lite", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_protobuf_lite", ] osgi_jar_with_tests( diff --git a/protocols/gnoi/ctl/BUILD b/protocols/gnoi/ctl/BUILD index 9fdb3a84d1..84322bafd7 100644 --- a/protocols/gnoi/ctl/BUILD +++ b/protocols/gnoi/ctl/BUILD @@ -3,18 +3,18 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ "//protocols/gnoi/stub:onos-protocols-gnoi-stub", "//protocols/grpc/api:onos-protocols-grpc-api", "//protocols/grpc/ctl:onos-protocols-grpc-ctl", - "//protocols/grpc:grpc-core", - "@com_google_protobuf//:protobuf_java", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//protobuf-lite", - "@io_grpc_grpc_java//stub", + "//lib:io_grpc_grpc_core_context", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:io_grpc_grpc_stub", "@com_google_api_grpc_proto_google_common_protos//jar", ] TEST_DEPS = TEST + [ "@minimal_json//jar", - "@io_grpc_grpc_java//core:inprocess", - "@io_grpc_grpc_java//protobuf-lite", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_protobuf_lite", ] osgi_jar_with_tests( diff --git a/protocols/grpc/BUILD b/protocols/grpc/BUILD index 3dd1084595..59a99f0b05 100644 --- a/protocols/grpc/BUILD +++ b/protocols/grpc/BUILD @@ -1,19 +1,15 @@ -load("//tools/build/bazel:osgi_java_library.bzl", "wrapped_osgi_jar") -load("//tools/build/bazel:variables.bzl", "GRPC_JAVA_VERSION") -load("//tools/build/bazel:variables.bzl", "PROTOBUF_VERSION") - BUNDLES = [ "//protocols/grpc/api:onos-protocols-grpc-api", "//protocols/grpc/ctl:onos-protocols-grpc-ctl", "//protocols/grpc/utils:onos-protocols-grpc-utils", # gRPC dependencies (with patched core) - ":grpc-core", - ":grpc-stub", - ":grpc-netty", - ":grpc-auth", - ":grpc-protobuf", - ":grpc-protobuf-lite", - ":protobuf-java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_stub", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_auth", + "//lib:io_grpc_grpc_protobuf", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:com_google_protobuf_protobuf_java", "@com_google_api_grpc_proto_google_common_protos//jar", "@com_google_errorprone_error_prone_annotations//jar", "@com_google_auth_google_auth_library_credentials//jar", @@ -30,83 +26,3 @@ onos_app( title = "gRPC Protocol Subsystem", url = "ttp://onosproject.org", ) - -# Wrap protobuf and grpc-related JARs in OSGi-compatible ones, since the -# original ones are built with Bazel and NOT imported via mvn. - -# FIXME: consider moving these rules somewhere else as other apps depend on it -# (e.g. openstacktelemetry and kafka-integration) but they don't directly -# depend on any onos-protocols-grpc-* module. - -GRPC_GROUP_ID = "io.grpc" - -PROTOBUF_GROUP_ID = "com.google.protobuf" - -wrapped_osgi_jar( - # Differently from the official "grpc-core" package, here we also include - # "grpc-context" to solve the OSGI split-brain problem: - # https://github.com/grpc/grpc-java/issues/2727 - # We use patched Bazel BUILD files to package together core and context (see - # tools/build/bazel/grpc_workspace.bzl). If you need grpc-context as a - # compile-time dependency, please use this one. - name = "grpc-core", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//core", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "grpc-stub", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//stub", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "grpc-netty", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//netty", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "grpc-auth", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//auth", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "grpc-protobuf", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//protobuf", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "grpc-protobuf-lite", - group = GRPC_GROUP_ID, - jar = "@io_grpc_grpc_java//protobuf-lite", - version = GRPC_JAVA_VERSION, - visibility = ["//visibility:public"], - deps = [], -) - -wrapped_osgi_jar( - name = "protobuf-java", - group = PROTOBUF_GROUP_ID, - jar = "@com_google_protobuf//:protobuf_java", - version = PROTOBUF_VERSION, - visibility = ["//visibility:public"], - deps = [], -) diff --git a/protocols/grpc/api/BUILD b/protocols/grpc/api/BUILD index 55e2b4a45b..5a2b2d7e1d 100644 --- a/protocols/grpc/api/BUILD +++ b/protocols/grpc/api/BUILD @@ -1,3 +1,3 @@ osgi_jar( - deps = CORE_DEPS + ["@io_grpc_grpc_java//core"], + deps = CORE_DEPS + ["//lib:io_grpc_grpc_core_context"], ) diff --git a/protocols/grpc/ctl/BUILD b/protocols/grpc/ctl/BUILD index fa10ff301d..16676c5546 100644 --- a/protocols/grpc/ctl/BUILD +++ b/protocols/grpc/ctl/BUILD @@ -1,9 +1,9 @@ COMPILE_DEPS = CORE_DEPS + [ "//protocols/grpc/api:onos-protocols-grpc-api", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//protobuf-lite", - "@com_google_protobuf//:protobuf_java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:com_google_protobuf_protobuf_java", "@com_google_api_grpc_proto_google_common_protos//jar", "@io_netty_netty_handler//jar", ] diff --git a/protocols/grpc/utils/BUILD b/protocols/grpc/utils/BUILD index 7baaf52ee6..25a78adae4 100644 --- a/protocols/grpc/utils/BUILD +++ b/protocols/grpc/utils/BUILD @@ -1,6 +1,6 @@ COMPILE_DEPS = CORE_DEPS + [ "//protocols/grpc/api:onos-protocols-grpc-api", - "@io_grpc_grpc_java//core", + "//lib:io_grpc_grpc_core_context", ] osgi_jar( diff --git a/protocols/p4runtime/api/BUILD b/protocols/p4runtime/api/BUILD index 2fb15bad70..47a4dd23e6 100644 --- a/protocols/p4runtime/api/BUILD +++ b/protocols/p4runtime/api/BUILD @@ -1,6 +1,6 @@ COMPILE_DEPS = CORE_DEPS + [ "//protocols/grpc/api:onos-protocols-grpc-api", - "@io_grpc_grpc_java//core", + "//lib:io_grpc_grpc_core_context", ] TEST_DEPS = TEST + [ diff --git a/protocols/p4runtime/ctl/BUILD b/protocols/p4runtime/ctl/BUILD index 31cd18482a..628d16281c 100644 --- a/protocols/p4runtime/ctl/BUILD +++ b/protocols/p4runtime/ctl/BUILD @@ -4,18 +4,18 @@ COMPILE_DEPS = CORE_DEPS + KRYO + [ "//protocols/grpc/ctl:onos-protocols-grpc-ctl", "//protocols/p4runtime/api:onos-protocols-p4runtime-api", "//protocols/p4runtime/proto:onos-protocols-p4runtime-proto", - "@com_google_protobuf//:protobuf_java", - "//protocols/grpc:grpc-core", - "@io_grpc_grpc_java//netty", - "@io_grpc_grpc_java//protobuf-lite", - "@io_grpc_grpc_java//stub", + "//lib:com_google_protobuf_protobuf_java", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_netty", + "//lib:io_grpc_grpc_protobuf_lite", + "//lib:io_grpc_grpc_stub", "@com_google_api_grpc_proto_google_common_protos//jar", ] TEST_DEPS = TEST + [ "@minimal_json//jar", - "@io_grpc_grpc_java//core:inprocess", - "@io_grpc_grpc_java//protobuf-lite", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_protobuf_lite", ] osgi_jar_with_tests( diff --git a/protocols/p4runtime/model/BUILD b/protocols/p4runtime/model/BUILD index 619d8eed0b..9e36b6d501 100644 --- a/protocols/p4runtime/model/BUILD +++ b/protocols/p4runtime/model/BUILD @@ -1,6 +1,6 @@ COMPILE_DEPS = CORE_DEPS + [ "//protocols/p4runtime/proto:onos-protocols-p4runtime-proto", - "@com_google_protobuf//:protobuf_java", + "//lib:com_google_protobuf_protobuf_java", ] osgi_jar_with_tests( diff --git a/providers/general/device/BUILD b/providers/general/device/BUILD index 40957b14ff..d8d39299e8 100644 --- a/providers/general/device/BUILD +++ b/providers/general/device/BUILD @@ -1,7 +1,7 @@ COMPILE_DEPS = CORE_DEPS + JACKSON + [ "//protocols/gnmi/stub:onos-protocols-gnmi-stub", "//protocols/gnmi/api:onos-protocols-gnmi-api", - "@com_google_protobuf//:protobuf_java", + "//lib:com_google_protobuf_protobuf_java", "//protocols/grpc/api:onos-protocols-grpc-api", ] diff --git a/tools/build/bazel/grpc_workspace.bzl b/tools/build/bazel/grpc_workspace.bzl index 93703b8b82..3c81c9a321 100644 --- a/tools/build/bazel/grpc_workspace.bzl +++ b/tools/build/bazel/grpc_workspace.bzl @@ -1,7 +1,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//tools/build/bazel:variables.bzl", "GRPC_JAVA_VERSION") -GRPC_VER = "1.18.0" +GRPC_JAVA_VERSION = "1.18.0" GRPC_SHA = "979cd1873c0f3aefa25f3d20336c023ce34471203bf2d954ad9e3158fc55c16b" GAPIS_COMMIT = "37cc0e5acae50ee91f00827a7010c3b07dfa5311" diff --git a/tools/build/bazel/osgi_java_library.bzl b/tools/build/bazel/osgi_java_library.bzl index c6fd52314f..beba414c19 100644 --- a/tools/build/bazel/osgi_java_library.bzl +++ b/tools/build/bazel/osgi_java_library.bzl @@ -364,7 +364,8 @@ def wrapped_osgi_jar( version = ONOS_VERSION, group = "org.onosproject", import_packages = "*", - visibility = ["//visibility:private"]): + visibility = ["//visibility:private"], + generate_pom = False): _bnd( name = name, source = jar, @@ -376,6 +377,14 @@ def wrapped_osgi_jar( web_xml = None, ) + if generate_pom: + pom_file( + name = name + "-pom", + artifact = name, + deps = deps, + visibility = visibility, + ) + """ Creates an OSGI jar and test jar file from a set of source and test files. See osgi_jar() for a description of shared parameters. @@ -698,7 +707,7 @@ def osgi_proto_jar( ":%s-proto-srcjar" % name, ] base_deps = [ - "@com_google_protobuf//:protobuf_java", + "//lib:com_google_protobuf_protobuf_java", ] if grpc_proto_lib != None: java_grpc_library( @@ -711,9 +720,9 @@ def osgi_proto_jar( ) base_deps.extend([ "@com_google_guava_guava//jar", - "@io_grpc_grpc_java//core", - "@io_grpc_grpc_java//stub", - "@io_grpc_grpc_java//protobuf", + "//lib:io_grpc_grpc_core_context", + "//lib:io_grpc_grpc_stub", + "//lib:io_grpc_grpc_protobuf", ]) osgi_jar( name = name, diff --git a/tools/build/bazel/protobuf_workspace.bzl b/tools/build/bazel/protobuf_workspace.bzl index bf7e62b44c..e67ba915f2 100644 --- a/tools/build/bazel/protobuf_workspace.bzl +++ b/tools/build/bazel/protobuf_workspace.bzl @@ -1,6 +1,6 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("//tools/build/bazel:variables.bzl", "PROTOBUF_VERSION") +PROTOBUF_VERSION = "3.6.1.3" SHA = "9510dd2afc29e7245e9e884336f848c8a6600a14ae726adb6befdb4f786f0be2" def generate_protobuf(): diff --git a/tools/build/bazel/variables.bzl b/tools/build/bazel/variables.bzl index 9eb4b1d1ea..acea2a95a8 100644 --- a/tools/build/bazel/variables.bzl +++ b/tools/build/bazel/variables.bzl @@ -4,6 +4,3 @@ ONOS_GROUP_ID = "org.onosproject" ONOS_ORIGIN = "ONOS Community" APP_PREFIX = ONOS_GROUP_ID + "." DEFAULT_APP_CATEGORY = "Utility" - -GRPC_JAVA_VERSION = "1.18.0" -PROTOBUF_VERSION = "3.6.1.3" diff --git a/tools/build/onos-publish-catalog b/tools/build/onos-publish-catalog index 874744ae10..3864b10e98 100755 --- a/tools/build/onos-publish-catalog +++ b/tools/build/onos-publish-catalog @@ -33,6 +33,14 @@ function jars { egrep -v '(\#|build/conf)' tools/build/publish-target-list } +function sourceJars { + egrep -v '(\#|lib\:|p4runtime/proto|build/conf)' tools/build/publish-target-list +} + +function javadocJars { + egrep -v '(\#|lib\:|p4runtime/proto|build/conf)' tools/build/publish-target-list +} + function testJars { egrep -v '(\#|build/conf)' tools/build/publish-test-target-list } @@ -46,9 +54,9 @@ writeCatalog $(testJars) [ $libsOnly = true ] && exit 0 echo "Cataloging source jars..." -writeCatalog $(jars | sed 's/$/-sources/') +writeCatalog $(sourceJars | sed 's/$/-sources/') echo "Cataloging javadoc jars..." -writeCatalog $(jars | sed 's/$/-javadoc/') +writeCatalog $(javadocJars | sed 's/$/-javadoc/') echo "Cataloging pom files..." writeCatalog $(jars | sed 's/$/-pom/') diff --git a/tools/build/publish-target-list b/tools/build/publish-target-list index 41b637ac06..4cf5ac511f 100644 --- a/tools/build/publish-target-list +++ b/tools/build/publish-target-list @@ -20,6 +20,7 @@ //protocols/grpc/api:onos-protocols-grpc-api //protocols/p4runtime/api:onos-protocols-p4runtime-api //protocols/p4runtime/model:onos-protocols-p4runtime-model + //protocols/p4runtime/proto:onos-protocols-p4runtime-proto //protocols/grpc/utils:onos-protocols-grpc-utils //protocols/gnmi/api:onos-protocols-gnmi-api //protocols/gnoi/api:onos-protocols-gnoi-api @@ -45,3 +46,7 @@ //utils/osgi:onlab-osgi //utils/rest:onlab-rest //web/api:onos-rest + //lib:com_google_protobuf_protobuf_java + //lib:io_grpc_grpc_core_context + //lib:io_grpc_grpc_stub + //lib:io_grpc_grpc_protobuf