Depend on official gnmi repo instead of fork
No need to maintain a separate fork of gnmi when what we need can be
achieved with a simple Bazel rule
Change-Id: I94ce6f617306e8fb68c44ec2a64743996d3c2f38
diff --git a/tools/build/bazel/gnmi_BUILD b/tools/build/bazel/gnmi_BUILD
index 43cb693..8ce0ac8 100644
--- a/tools/build/bazel/gnmi_BUILD
+++ b/tools/build/bazel/gnmi_BUILD
@@ -1,6 +1,9 @@
+# Prefix string to remove from proto import statements
+IMPORT_PREFIX = "github.com/openconfig/gnmi/proto/"
+
proto_library(
name = "gnmi_proto",
- srcs = ["gnmi/gnmi.proto"],
+ srcs = [":gnmi_proto_sed"],
deps = [
":gnmi_ext_proto",
"@com_google_protobuf//:descriptor_proto",
@@ -9,9 +12,17 @@
visibility = ["//visibility:public"],
)
-
proto_library(
name = "gnmi_ext_proto",
srcs = ["gnmi_ext/gnmi_ext.proto"],
visibility = ["//visibility:public"],
)
+
+
+genrule(
+ name = "gnmi_proto_sed",
+ srcs = [":gnmi/gnmi.proto"],
+ outs = ["new/gnmi/gnmi.proto"],
+ cmd = "sed -e 's:import \"%s:import \":g' $(location :gnmi/gnmi.proto) > \"$@\""
+ % IMPORT_PREFIX,
+)
diff --git a/tools/build/bazel/gnmi_workspace.bzl b/tools/build/bazel/gnmi_workspace.bzl
index 6b0d4db..55b76b6 100644
--- a/tools/build/bazel/gnmi_workspace.bzl
+++ b/tools/build/bazel/gnmi_workspace.bzl
@@ -1,15 +1,12 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-# FIXME: Currently gNMI proto file uses incorrect path to import "gnmi_ext.proto"
-# Temporary use patch from ONF before gNMI team fix it.
-
-GNMI_COMMIT = "onos"
-GNMI_SHA = "0c4d5f168cb142f8135171204dac3ff8840a147f51fa361079f42fa585bec2ce"
+GNMI_COMMIT = "33a1865c302903e7a2e06f35960e6bc31e84b9f6"
+GNMI_SHA = "cfd412410589e8e019b90681649afdb602f410a0ac67cfa1186a20d73be43e58"
def generate_gnmi():
http_archive(
name = "com_github_openconfig_gnmi",
- urls = ["https://github.com/opennetworkinglab/gnmi/archive/%s.zip" % GNMI_COMMIT],
+ urls = ["https://github.com/openconfig/gnmi/archive/%s.zip" % GNMI_COMMIT],
sha256 = GNMI_SHA,
strip_prefix = "gnmi-%s/proto" % GNMI_COMMIT,
build_file = "//tools/build/bazel:gnmi_BUILD",