Skip to content

Commit

Permalink
Merge pull request grpc#5213 from ctiller/fix-proto-docker
Browse files Browse the repository at this point in the history
Proto API for LB request/responses (redux)
  • Loading branch information
dgquintas committed Feb 23, 2016
2 parents 4938274 + 70ab4c5 commit 0a5f613
Show file tree
Hide file tree
Showing 33 changed files with 1,704 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@
[submodule "third_party/boringssl"]
path = third_party/boringssl
url = https://boringssl.googlesource.com/boringssl
[submodule "third_party/nanopb"]
path = third_party/nanopb
url = https://github.com/nanopb/nanopb.git
33 changes: 33 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ cc_library(
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/initial_connect_string.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down Expand Up @@ -228,6 +229,7 @@ cc_library(
"src/core/json/json_common.h",
"src/core/json/json_reader.h",
"src/core/json/json_writer.h",
"src/core/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/statistics/census_interface.h",
"src/core/statistics/census_rpc_stats.h",
"src/core/surface/api_trace.h",
Expand Down Expand Up @@ -284,6 +286,10 @@ cc_library(
"src/core/census/aggregation.h",
"src/core/census/mlog.h",
"src/core/census/rpc_metric_id.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
"src/core/channel/channel_args.c",
Expand All @@ -299,6 +305,7 @@ cc_library(
"src/core/client_config/connector.c",
"src/core/client_config/default_initial_connect_string.c",
"src/core/client_config/initial_connect_string.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -363,6 +370,7 @@ cc_library(
"src/core/json/json_reader.c",
"src/core/json/json_string.c",
"src/core/json/json_writer.c",
"src/core/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/surface/alarm.c",
"src/core/surface/api_trace.c",
"src/core/surface/byte_buffer.c",
Expand Down Expand Up @@ -439,6 +447,9 @@ cc_library(
"src/core/census/operation.c",
"src/core/census/placeholders.c",
"src/core/census/tracing.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
],
hdrs = [
"include/grpc/grpc_security.h",
Expand Down Expand Up @@ -487,6 +498,7 @@ cc_library(
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/initial_connect_string.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down Expand Up @@ -547,6 +559,7 @@ cc_library(
"src/core/json/json_common.h",
"src/core/json/json_reader.h",
"src/core/json/json_writer.h",
"src/core/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/statistics/census_interface.h",
"src/core/statistics/census_rpc_stats.h",
"src/core/surface/api_trace.h",
Expand Down Expand Up @@ -589,6 +602,10 @@ cc_library(
"src/core/census/aggregation.h",
"src/core/census/mlog.h",
"src/core/census/rpc_metric_id.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
"src/core/surface/init_unsecure.c",
"src/core/census/grpc_context.c",
"src/core/census/grpc_filter.c",
Expand All @@ -605,6 +622,7 @@ cc_library(
"src/core/client_config/connector.c",
"src/core/client_config/default_initial_connect_string.c",
"src/core/client_config/initial_connect_string.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -669,6 +687,7 @@ cc_library(
"src/core/json/json_reader.c",
"src/core/json/json_string.c",
"src/core/json/json_writer.c",
"src/core/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/surface/alarm.c",
"src/core/surface/api_trace.c",
"src/core/surface/byte_buffer.c",
Expand Down Expand Up @@ -724,6 +743,9 @@ cc_library(
"src/core/census/operation.c",
"src/core/census/placeholders.c",
"src/core/census/tracing.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
],
hdrs = [
"include/grpc/byte_buffer.h",
Expand Down Expand Up @@ -1262,6 +1284,7 @@ objc_library(
"src/core/client_config/connector.c",
"src/core/client_config/default_initial_connect_string.c",
"src/core/client_config/initial_connect_string.c",
"src/core/client_config/lb_policies/load_balancer_api.c",
"src/core/client_config/lb_policies/pick_first.c",
"src/core/client_config/lb_policies/round_robin.c",
"src/core/client_config/lb_policy.c",
Expand Down Expand Up @@ -1326,6 +1349,7 @@ objc_library(
"src/core/json/json_reader.c",
"src/core/json/json_string.c",
"src/core/json/json_writer.c",
"src/core/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/surface/alarm.c",
"src/core/surface/api_trace.c",
"src/core/surface/byte_buffer.c",
Expand Down Expand Up @@ -1402,6 +1426,9 @@ objc_library(
"src/core/census/operation.c",
"src/core/census/placeholders.c",
"src/core/census/tracing.c",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_encode.c",
],
hdrs = [
"include/grpc/grpc_security.h",
Expand Down Expand Up @@ -1431,6 +1458,7 @@ objc_library(
"src/core/client_config/client_config.h",
"src/core/client_config/connector.h",
"src/core/client_config/initial_connect_string.h",
"src/core/client_config/lb_policies/load_balancer_api.h",
"src/core/client_config/lb_policies/pick_first.h",
"src/core/client_config/lb_policies/round_robin.h",
"src/core/client_config/lb_policy.h",
Expand Down Expand Up @@ -1491,6 +1519,7 @@ objc_library(
"src/core/json/json_common.h",
"src/core/json/json_reader.h",
"src/core/json/json_writer.h",
"src/core/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/statistics/census_interface.h",
"src/core/statistics/census_rpc_stats.h",
"src/core/surface/api_trace.h",
Expand Down Expand Up @@ -1547,6 +1576,10 @@ objc_library(
"src/core/census/aggregation.h",
"src/core/census/mlog.h",
"src/core/census/rpc_metric_id.h",
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.h",
],
includes = [
"include",
Expand Down
76 changes: 76 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,7 @@ grpc_csharp_plugin: $(BINDIR)/$(CONFIG)/grpc_csharp_plugin
grpc_objective_c_plugin: $(BINDIR)/$(CONFIG)/grpc_objective_c_plugin
grpc_python_plugin: $(BINDIR)/$(CONFIG)/grpc_python_plugin
grpc_ruby_plugin: $(BINDIR)/$(CONFIG)/grpc_ruby_plugin
grpclb_api_test: $(BINDIR)/$(CONFIG)/grpclb_api_test
hybrid_end2end_test: $(BINDIR)/$(CONFIG)/hybrid_end2end_test
interop_client: $(BINDIR)/$(CONFIG)/interop_client
interop_server: $(BINDIR)/$(CONFIG)/interop_server
Expand Down Expand Up @@ -1285,6 +1286,7 @@ buildtests_cxx: buildtests_zookeeper privatelibs_cxx \
$(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test \
$(BINDIR)/$(CONFIG)/generic_end2end_test \
$(BINDIR)/$(CONFIG)/grpc_cli \
$(BINDIR)/$(CONFIG)/grpclb_api_test \
$(BINDIR)/$(CONFIG)/hybrid_end2end_test \
$(BINDIR)/$(CONFIG)/interop_client \
$(BINDIR)/$(CONFIG)/interop_server \
Expand Down Expand Up @@ -1595,6 +1597,8 @@ test_cxx: test_zookeeper buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/generic_async_streaming_ping_pong_test || ( echo test generic_async_streaming_ping_pong_test failed ; exit 1 )
$(E) "[RUN] Testing generic_end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/generic_end2end_test || ( echo test generic_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing grpclb_api_test"
$(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 )
$(E) "[RUN] Testing hybrid_end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/hybrid_end2end_test || ( echo test hybrid_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing interop_test"
Expand Down Expand Up @@ -1746,6 +1750,21 @@ $(LIBDIR)/$(CONFIG)/pkgconfig/grpc++_unsecure.pc:
$(Q) mkdir -p $(@D)
$(Q) echo "$(GRPCXX_UNSECURE_PC_FILE)" | tr , '\n' >$@

ifeq ($(NO_PROTOC),true)
$(GENDIR)/src/proto/grpc/lb/v0/load_balancer.pb.cc: protoc_dep_error
$(GENDIR)/src/proto/grpc/lb/v0/load_balancer.grpc.pb.cc: protoc_dep_error
else
$(GENDIR)/src/proto/grpc/lb/v0/load_balancer.pb.cc: src/proto/grpc/lb/v0/load_balancer.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[PROTOC] Generating protobuf CC file from $<"
$(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) --cpp_out=$(GENDIR) $<

$(GENDIR)/src/proto/grpc/lb/v0/load_balancer.grpc.pb.cc: src/proto/grpc/lb/v0/load_balancer.proto $(PROTOBUF_DEP) $(PROTOC_PLUGINS)
$(E) "[GRPC] Generating gRPC's protobuf service CC file from $<"
$(Q) mkdir -p `dirname $@`
$(Q) $(PROTOC) --grpc_out=$(GENDIR) --plugin=protoc-gen-grpc=$(BINDIR)/$(CONFIG)/grpc_cpp_plugin $<
endif

ifeq ($(NO_PROTOC),true)
$(GENDIR)/src/proto/grpc/testing/control.pb.cc: protoc_dep_error
$(GENDIR)/src/proto/grpc/testing/control.grpc.pb.cc: protoc_dep_error
Expand Down Expand Up @@ -2333,6 +2352,7 @@ LIBGRPC_SRC = \
src/core/client_config/connector.c \
src/core/client_config/default_initial_connect_string.c \
src/core/client_config/initial_connect_string.c \
src/core/client_config/lb_policies/load_balancer_api.c \
src/core/client_config/lb_policies/pick_first.c \
src/core/client_config/lb_policies/round_robin.c \
src/core/client_config/lb_policy.c \
Expand Down Expand Up @@ -2397,6 +2417,7 @@ LIBGRPC_SRC = \
src/core/json/json_reader.c \
src/core/json/json_string.c \
src/core/json/json_writer.c \
src/core/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/surface/alarm.c \
src/core/surface/api_trace.c \
src/core/surface/byte_buffer.c \
Expand Down Expand Up @@ -2473,6 +2494,9 @@ LIBGRPC_SRC = \
src/core/census/operation.c \
src/core/census/placeholders.c \
src/core/census/tracing.c \
third_party/nanopb/pb_common.c \
third_party/nanopb/pb_decode.c \
third_party/nanopb/pb_encode.c \

PUBLIC_HEADERS_C += \
include/grpc/grpc_security.h \
Expand Down Expand Up @@ -2640,6 +2664,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/client_config/connector.c \
src/core/client_config/default_initial_connect_string.c \
src/core/client_config/initial_connect_string.c \
src/core/client_config/lb_policies/load_balancer_api.c \
src/core/client_config/lb_policies/pick_first.c \
src/core/client_config/lb_policies/round_robin.c \
src/core/client_config/lb_policy.c \
Expand Down Expand Up @@ -2704,6 +2729,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/json/json_reader.c \
src/core/json/json_string.c \
src/core/json/json_writer.c \
src/core/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/surface/alarm.c \
src/core/surface/api_trace.c \
src/core/surface/byte_buffer.c \
Expand Down Expand Up @@ -2759,6 +2785,9 @@ LIBGRPC_UNSECURE_SRC = \
src/core/census/operation.c \
src/core/census/placeholders.c \
src/core/census/tracing.c \
third_party/nanopb/pb_common.c \
third_party/nanopb/pb_decode.c \
third_party/nanopb/pb_encode.c \

PUBLIC_HEADERS_C += \
include/grpc/byte_buffer.h \
Expand Down Expand Up @@ -9712,6 +9741,53 @@ ifneq ($(NO_DEPS),true)
endif


GRPCLB_API_TEST_SRC = \
$(GENDIR)/src/proto/grpc/lb/v0/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v0/load_balancer.grpc.pb.cc \
test/cpp/grpclb/grpclb_api_test.cc \

GRPCLB_API_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GRPCLB_API_TEST_SRC))))
ifeq ($(NO_SECURE),true)

# You can't build secure targets if you don't have OpenSSL.

$(BINDIR)/$(CONFIG)/grpclb_api_test: openssl_dep_error

else




ifeq ($(NO_PROTOBUF),true)

# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.0.0+.

$(BINDIR)/$(CONFIG)/grpclb_api_test: protobuf_dep_error

else

$(BINDIR)/$(CONFIG)/grpclb_api_test: $(PROTOBUF_DEP) $(GRPCLB_API_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(GRPCLB_API_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/grpclb_api_test

endif

endif

$(OBJDIR)/$(CONFIG)/src/proto/grpc/lb/v0/load_balancer.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a

$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_api_test.o: $(LIBDIR)/$(CONFIG)/libgrpc++_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a

deps_grpclb_api_test: $(GRPCLB_API_TEST_OBJS:.o=.dep)

ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GRPCLB_API_TEST_OBJS:.o=.dep)
endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/grpclb/grpclb_api_test.o: $(GENDIR)/src/proto/grpc/lb/v0/load_balancer.pb.cc $(GENDIR)/src/proto/grpc/lb/v0/load_balancer.grpc.pb.cc


HYBRID_END2END_TEST_SRC = \
test/cpp/end2end/hybrid_end2end_test.cc \

Expand Down
5 changes: 5 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@
'src/core/client_config/connector.c',
'src/core/client_config/default_initial_connect_string.c',
'src/core/client_config/initial_connect_string.c',
'src/core/client_config/lb_policies/load_balancer_api.c',
'src/core/client_config/lb_policies/pick_first.c',
'src/core/client_config/lb_policies/round_robin.c',
'src/core/client_config/lb_policy.c',
Expand Down Expand Up @@ -636,6 +637,7 @@
'src/core/json/json_reader.c',
'src/core/json/json_string.c',
'src/core/json/json_writer.c',
'src/core/proto/grpc/lb/v0/load_balancer.pb.c',
'src/core/surface/alarm.c',
'src/core/surface/api_trace.c',
'src/core/surface/byte_buffer.c',
Expand Down Expand Up @@ -712,6 +714,9 @@
'src/core/census/operation.c',
'src/core/census/placeholders.c',
'src/core/census/tracing.c',
'third_party/nanopb/pb_common.c',
'third_party/nanopb/pb_decode.c',
'third_party/nanopb/pb_encode.c',
],
"conditions": [
['OS == "mac"', {
Expand Down
Loading

0 comments on commit 0a5f613

Please sign in to comment.