aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--bazel/grpc_deps.bzl10
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc4
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h2
-rw-r--r--src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h4
-rw-r--r--src/core/tsi/alts/handshaker/altscontext.pb.h2
-rw-r--r--src/core/tsi/alts/handshaker/handshaker.pb.h2
-rw-r--r--src/core/tsi/alts/handshaker/transport_security_common.pb.h2
-rw-r--r--src/core/tsi/alts/handshaker/transport_security_common_api.h4
-rw-r--r--src/cpp/server/health/default_health_check_service.cc4
-rw-r--r--src/cpp/server/health/health.pb.h2
-rw-r--r--templates/Makefile.template4
-rw-r--r--third_party/nanopb.BUILD19
-rwxr-xr-xtools/codegen/core/gen_nano_proto.sh3
14 files changed, 48 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 0e54fb2683..17b723a96c 100644
--- a/Makefile
+++ b/Makefile
@@ -338,7 +338,9 @@ CPPFLAGS += -g -Wall -Wextra -Werror -Wno-long-long -Wno-unused-parameter -DOSAT
COREFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += -g
-DEFINES += PB_FIELD_16BIT
+# nanopb tweaks
+DEFINES += PB_FIELD_32BIT
+CPPFLAGS += -Ithird_party/nanopb
CPPFLAGS += $(CPPFLAGS_$(CONFIG))
CFLAGS += $(CFLAGS_$(CONFIG))
diff --git a/bazel/grpc_deps.bzl b/bazel/grpc_deps.bzl
index 50d1d24303..9732e27a7e 100644
--- a/bazel/grpc_deps.bzl
+++ b/bazel/grpc_deps.bzl
@@ -5,7 +5,7 @@ def grpc_deps():
native.bind(
name = "nanopb",
- actual = "@com_github_grpc_grpc//third_party/nanopb:nanopb",
+ actual = "@com_github_nanopb_nanopb//:nanopb",
)
native.bind(
@@ -93,6 +93,14 @@ def grpc_deps():
name = "com_google_protobuf",
strip_prefix = "protobuf-b5fbb742af122b565925987e65c08957739976a7",
url = "https://github.com/google/protobuf/archive/b5fbb742af122b565925987e65c08957739976a7.tar.gz",
+ )
+
+ if "com_github_nanopb_nanopb" not in native.existing_rules():
+ native.new_http_archive(
+ name = "com_github_nanopb_nanopb",
+ build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
+ strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b",
+ url = "https://github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz",
)
if "com_github_google_googletest" not in native.existing_rules():
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
index ed246273c9..8f031b0679 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
@@ -19,8 +19,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
-#include "third_party/nanopb/pb_decode.h"
-#include "third_party/nanopb/pb_encode.h"
+#include "pb_decode.h"
+#include "pb_encode.h"
#include <grpc/support/alloc.h>
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
index 066c076202..088b6f513a 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h
@@ -3,7 +3,7 @@
#ifndef PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
#define PB_GRPC_LB_V1_LOAD_BALANCER_PB_H_INCLUDED
-#include "third_party/nanopb/pb.h"
+#include "pb.h"
/* @@protoc_insertion_point(includes) */
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
diff --git a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h b/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h
index 8fe8f73f8b..966ea45617 100644
--- a/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h
+++ b/src/core/tsi/alts/handshaker/alts_handshaker_service_api_util.h
@@ -21,8 +21,8 @@
#include <grpc/support/port_platform.h>
-#include "third_party/nanopb/pb_decode.h"
-#include "third_party/nanopb/pb_encode.h"
+#include "pb_decode.h"
+#include "pb_encode.h"
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
diff --git a/src/core/tsi/alts/handshaker/altscontext.pb.h b/src/core/tsi/alts/handshaker/altscontext.pb.h
index 3e72d7f678..f11b2899e9 100644
--- a/src/core/tsi/alts/handshaker/altscontext.pb.h
+++ b/src/core/tsi/alts/handshaker/altscontext.pb.h
@@ -3,7 +3,7 @@
#ifndef PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED
#define PB_GRPC_GCP_ALTSCONTEXT_PB_H_INCLUDED
-#include "third_party/nanopb/pb.h"
+#include "pb.h"
#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
/* @@protoc_insertion_point(includes) */
diff --git a/src/core/tsi/alts/handshaker/handshaker.pb.h b/src/core/tsi/alts/handshaker/handshaker.pb.h
index 0805a144de..e2b193463c 100644
--- a/src/core/tsi/alts/handshaker/handshaker.pb.h
+++ b/src/core/tsi/alts/handshaker/handshaker.pb.h
@@ -3,7 +3,7 @@
#ifndef PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED
#define PB_GRPC_GCP_HANDSHAKER_PB_H_INCLUDED
-#include "third_party/nanopb/pb.h"
+#include "pb.h"
#include "src/core/tsi/alts/handshaker/transport_security_common.pb.h"
/* @@protoc_insertion_point(includes) */
diff --git a/src/core/tsi/alts/handshaker/transport_security_common.pb.h b/src/core/tsi/alts/handshaker/transport_security_common.pb.h
index 49096dffa3..87d9abf149 100644
--- a/src/core/tsi/alts/handshaker/transport_security_common.pb.h
+++ b/src/core/tsi/alts/handshaker/transport_security_common.pb.h
@@ -3,7 +3,7 @@
#ifndef PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
#define PB_GRPC_GCP_TRANSPORT_SECURITY_COMMON_PB_H_INCLUDED
-#include "third_party/nanopb/pb.h"
+#include "pb.h"
/* @@protoc_insertion_point(includes) */
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
diff --git a/src/core/tsi/alts/handshaker/transport_security_common_api.h b/src/core/tsi/alts/handshaker/transport_security_common_api.h
index 68228cb3b5..ec2a0b4b5e 100644
--- a/src/core/tsi/alts/handshaker/transport_security_common_api.h
+++ b/src/core/tsi/alts/handshaker/transport_security_common_api.h
@@ -21,8 +21,8 @@
#include <grpc/support/port_platform.h>
-#include "third_party/nanopb/pb_decode.h"
-#include "third_party/nanopb/pb_encode.h"
+#include "pb_decode.h"
+#include "pb_encode.h"
#include <grpc/slice.h>
#include <grpc/slice_buffer.h>
diff --git a/src/cpp/server/health/default_health_check_service.cc b/src/cpp/server/health/default_health_check_service.cc
index 0b45a8b714..93d0a192e0 100644
--- a/src/cpp/server/health/default_health_check_service.cc
+++ b/src/cpp/server/health/default_health_check_service.cc
@@ -26,8 +26,8 @@
#include "src/cpp/server/health/default_health_check_service.h"
#include "src/cpp/server/health/health.pb.h"
-#include "third_party/nanopb/pb_decode.h"
-#include "third_party/nanopb/pb_encode.h"
+#include "pb_decode.h"
+#include "pb_encode.h"
namespace grpc {
namespace {
diff --git a/src/cpp/server/health/health.pb.h b/src/cpp/server/health/health.pb.h
index 7051b3260a..29e1f3bacb 100644
--- a/src/cpp/server/health/health.pb.h
+++ b/src/cpp/server/health/health.pb.h
@@ -3,7 +3,7 @@
#ifndef PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED
#define PB_GRPC_HEALTH_V1_HEALTH_PB_H_INCLUDED
-#include "third_party/nanopb/pb.h"
+#include "pb.h"
/* @@protoc_insertion_point(includes) */
#if PB_PROTO_HEADER_VERSION != 30
#error Regenerate this file with the current version of nanopb generator.
diff --git a/templates/Makefile.template b/templates/Makefile.template
index 901dbfc9c8..8532adf789 100644
--- a/templates/Makefile.template
+++ b/templates/Makefile.template
@@ -221,7 +221,9 @@
% endif
% endfor
- DEFINES += PB_FIELD_16BIT
+ # nanopb tweaks
+ DEFINES += PB_FIELD_32BIT
+ CPPFLAGS += -Ithird_party/nanopb
CPPFLAGS += $(CPPFLAGS_$(CONFIG))
CFLAGS += $(CFLAGS_$(CONFIG))
diff --git a/third_party/nanopb.BUILD b/third_party/nanopb.BUILD
new file mode 100644
index 0000000000..46ca53a8fe
--- /dev/null
+++ b/third_party/nanopb.BUILD
@@ -0,0 +1,19 @@
+cc_library(
+ name = "nanopb",
+ srcs = [
+ "pb_common.c",
+ "pb_decode.c",
+ "pb_encode.c",
+ ],
+ hdrs = [
+ "pb.h",
+ "pb_common.h",
+ "pb_decode.h",
+ "pb_encode.h",
+ ],
+ defines = [
+ "PB_FIELD_32BIT=1",
+ ],
+ visibility = ["//visibility:public"],
+)
+
diff --git a/tools/codegen/core/gen_nano_proto.sh b/tools/codegen/core/gen_nano_proto.sh
index 6ce15178bd..c56429a320 100755
--- a/tools/codegen/core/gen_nano_proto.sh
+++ b/tools/codegen/core/gen_nano_proto.sh
@@ -74,8 +74,7 @@ pushd "$(dirname $INPUT_PROTO)" > /dev/null
protoc \
--plugin=protoc-gen-nanopb="$GRPC_ROOT/third_party/nanopb/generator/protoc-gen-nanopb" \
---nanopb_out='-T -L#include\ \"third_party/nanopb/pb.h\"'":$OUTPUT_DIR" \
-"$(basename $INPUT_PROTO)"
+--nanopb_out='-T -L#include\ \"pb.h\"'":$OUTPUT_DIR" "$(basename $INPUT_PROTO)"
readonly PROTO_BASENAME=$(basename $INPUT_PROTO .proto)
sed -i "s:$PROTO_BASENAME.pb.h:${GRPC_OUTPUT_DIR}/$PROTO_BASENAME.pb.h:g" \