Skip to content

Commit

Permalink
Merge pull request grpc#10849 from muxi/backward-compat
Browse files Browse the repository at this point in the history
Implement Server Backward Compatibility
  • Loading branch information
muxi committed May 12, 2017
2 parents a1ae21d + 21a6cca commit a2d9d48
Show file tree
Hide file tree
Showing 43 changed files with 8,922 additions and 3,907 deletions.
73 changes: 73 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c h2_full+pipe_test)
endif()
add_dependencies(buildtests_c h2_full+trace_test)
add_dependencies(buildtests_c h2_full+workarounds_test)
add_dependencies(buildtests_c h2_http_proxy_test)
add_dependencies(buildtests_c h2_load_reporting_test)
add_dependencies(buildtests_c h2_oauth2_test)
Expand All @@ -586,6 +587,7 @@ if(_gRPC_PLATFORM_LINUX)
add_dependencies(buildtests_c h2_full+pipe_nosec_test)
endif()
add_dependencies(buildtests_c h2_full+trace_nosec_test)
add_dependencies(buildtests_c h2_full+workarounds_nosec_test)
add_dependencies(buildtests_c h2_http_proxy_nosec_test)
add_dependencies(buildtests_c h2_load_reporting_nosec_test)
add_dependencies(buildtests_c h2_proxy_nosec_test)
Expand Down Expand Up @@ -848,6 +850,7 @@ foreach(_hdr
include/grpc/support/tls_msvc.h
include/grpc/support/tls_pthread.h
include/grpc/support/useful.h
include/grpc/support/workaround_list.h
include/grpc/impl/codegen/atm.h
include/grpc/impl/codegen/atm_gcc_atomic.h
include/grpc/impl/codegen/atm_gcc_sync.h
Expand Down Expand Up @@ -1162,6 +1165,8 @@ add_library(grpc
src/core/ext/census/tracing.c
src/core/ext/filters/max_age/max_age_filter.c
src/core/ext/filters/message_size/message_size_filter.c
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
src/core/ext/filters/workarounds/workaround_utils.c
src/core/plugin_registry/grpc_plugin_registry.c
)

Expand Down Expand Up @@ -2045,6 +2050,8 @@ add_library(grpc_unsecure
src/core/ext/census/tracing.c
src/core/ext/filters/max_age/max_age_filter.c
src/core/ext/filters/message_size/message_size_filter.c
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
src/core/ext/filters/workarounds/workaround_utils.c
src/core/plugin_registry/grpc_unsecure_plugin_registry.c
)

Expand Down Expand Up @@ -4578,6 +4585,7 @@ add_library(end2end_tests
test/core/end2end/tests/simple_request.c
test/core/end2end/tests/streaming_error_response.c
test/core/end2end/tests/trailing_metadata.c
test/core/end2end/tests/workaround_cronet_compression.c
test/core/end2end/tests/write_buffering.c
test/core/end2end/tests/write_buffering_at_end.c
)
Expand Down Expand Up @@ -4675,6 +4683,7 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/simple_request.c
test/core/end2end/tests/streaming_error_response.c
test/core/end2end/tests/trailing_metadata.c
test/core/end2end/tests/workaround_cronet_compression.c
test/core/end2end/tests/write_buffering.c
test/core/end2end/tests/write_buffering_at_end.c
)
Expand Down Expand Up @@ -13129,6 +13138,38 @@ target_link_libraries(h2_full+trace_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)

add_executable(h2_full+workarounds_test
test/core/end2end/fixtures/h2_full+workarounds.c
)


target_include_directories(h2_full+workarounds_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${BENCHMARK_ROOT_DIR}/include
PRIVATE ${ZLIB_ROOT_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
PRIVATE ${CARES_BUILD_INCLUDE_DIR}
PRIVATE ${CARES_INCLUDE_DIR}
PRIVATE ${CARES_PLATFORM_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)

target_link_libraries(h2_full+workarounds_test
${_gRPC_ALLTARGETS_LIBRARIES}
end2end_tests
grpc_test_util
grpc
gpr_test_util
gpr
)

endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)

add_executable(h2_http_proxy_test
test/core/end2end/fixtures/h2_http_proxy.c
)
Expand Down Expand Up @@ -13679,6 +13720,38 @@ target_link_libraries(h2_full+trace_nosec_test
endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)

add_executable(h2_full+workarounds_nosec_test
test/core/end2end/fixtures/h2_full+workarounds.c
)


target_include_directories(h2_full+workarounds_nosec_test
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
PRIVATE ${BORINGSSL_ROOT_DIR}/include
PRIVATE ${PROTOBUF_ROOT_DIR}/src
PRIVATE ${BENCHMARK_ROOT_DIR}/include
PRIVATE ${ZLIB_ROOT_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib
PRIVATE ${CARES_BUILD_INCLUDE_DIR}
PRIVATE ${CARES_INCLUDE_DIR}
PRIVATE ${CARES_PLATFORM_INCLUDE_DIR}
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/cares/cares
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/third_party/gflags/include
)

target_link_libraries(h2_full+workarounds_nosec_test
${_gRPC_ALLTARGETS_LIBRARIES}
end2end_nosec_tests
grpc_test_util_unsecure
grpc_unsecure
gpr_test_util
gpr
)

endif (gRPC_BUILD_TESTS)
if (gRPC_BUILD_TESTS)

add_executable(h2_http_proxy_nosec_test
test/core/end2end/fixtures/h2_http_proxy.c
)
Expand Down
63 changes: 63 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1249,6 +1249,7 @@ h2_fd_test: $(BINDIR)/$(CONFIG)/h2_fd_test
h2_full_test: $(BINDIR)/$(CONFIG)/h2_full_test
h2_full+pipe_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_test
h2_full+trace_test: $(BINDIR)/$(CONFIG)/h2_full+trace_test
h2_full+workarounds_test: $(BINDIR)/$(CONFIG)/h2_full+workarounds_test
h2_http_proxy_test: $(BINDIR)/$(CONFIG)/h2_http_proxy_test
h2_load_reporting_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_test
h2_oauth2_test: $(BINDIR)/$(CONFIG)/h2_oauth2_test
Expand All @@ -1266,6 +1267,7 @@ h2_fd_nosec_test: $(BINDIR)/$(CONFIG)/h2_fd_nosec_test
h2_full_nosec_test: $(BINDIR)/$(CONFIG)/h2_full_nosec_test
h2_full+pipe_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test
h2_full+trace_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test
h2_full+workarounds_nosec_test: $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test
h2_http_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test
h2_load_reporting_nosec_test: $(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test
h2_proxy_nosec_test: $(BINDIR)/$(CONFIG)/h2_proxy_nosec_test
Expand Down Expand Up @@ -1494,6 +1496,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_full_test \
$(BINDIR)/$(CONFIG)/h2_full+pipe_test \
$(BINDIR)/$(CONFIG)/h2_full+trace_test \
$(BINDIR)/$(CONFIG)/h2_full+workarounds_test \
$(BINDIR)/$(CONFIG)/h2_http_proxy_test \
$(BINDIR)/$(CONFIG)/h2_load_reporting_test \
$(BINDIR)/$(CONFIG)/h2_oauth2_test \
Expand All @@ -1511,6 +1514,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/h2_full_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+pipe_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+trace_nosec_test \
$(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test \
$(BINDIR)/$(CONFIG)/h2_http_proxy_nosec_test \
$(BINDIR)/$(CONFIG)/h2_load_reporting_nosec_test \
$(BINDIR)/$(CONFIG)/h2_proxy_nosec_test \
Expand Down Expand Up @@ -2818,6 +2822,7 @@ PUBLIC_HEADERS_C += \
include/grpc/support/tls_msvc.h \
include/grpc/support/tls_pthread.h \
include/grpc/support/useful.h \
include/grpc/support/workaround_list.h \
include/grpc/impl/codegen/atm.h \
include/grpc/impl/codegen/atm_gcc_atomic.h \
include/grpc/impl/codegen/atm_gcc_sync.h \
Expand Down Expand Up @@ -3137,6 +3142,8 @@ LIBGRPC_SRC = \
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_plugin_registry.c \

PUBLIC_HEADERS_C += \
Expand Down Expand Up @@ -3989,6 +3996,8 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_unsecure_plugin_registry.c \

PUBLIC_HEADERS_C += \
Expand Down Expand Up @@ -8466,6 +8475,7 @@ LIBEND2END_TESTS_SRC = \
test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \
test/core/end2end/tests/workaround_cronet_compression.c \
test/core/end2end/tests/write_buffering.c \
test/core/end2end/tests/write_buffering_at_end.c \

Expand Down Expand Up @@ -8558,6 +8568,7 @@ LIBEND2END_NOSEC_TESTS_SRC = \
test/core/end2end/tests/simple_request.c \
test/core/end2end/tests/streaming_error_response.c \
test/core/end2end/tests/trailing_metadata.c \
test/core/end2end/tests/workaround_cronet_compression.c \
test/core/end2end/tests/write_buffering.c \
test/core/end2end/tests/write_buffering_at_end.c \

Expand Down Expand Up @@ -18603,6 +18614,38 @@ endif
endif


H2_FULL+WORKAROUNDS_TEST_SRC = \
test/core/end2end/fixtures/h2_full+workarounds.c \

H2_FULL+WORKAROUNDS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FULL+WORKAROUNDS_TEST_SRC))))
ifeq ($(NO_SECURE),true)

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

$(BINDIR)/$(CONFIG)/h2_full+workarounds_test: openssl_dep_error

else



$(BINDIR)/$(CONFIG)/h2_full+workarounds_test: $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_test

endif

$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+workarounds.o: $(LIBDIR)/$(CONFIG)/libend2end_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a

deps_h2_full+workarounds_test: $(H2_FULL+WORKAROUNDS_TEST_OBJS:.o=.dep)

ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(H2_FULL+WORKAROUNDS_TEST_OBJS:.o=.dep)
endif
endif


H2_HTTP_PROXY_TEST_SRC = \
test/core/end2end/fixtures/h2_http_proxy.c \

Expand Down Expand Up @@ -19075,6 +19118,26 @@ ifneq ($(NO_DEPS),true)
endif


H2_FULL+WORKAROUNDS_NOSEC_TEST_SRC = \
test/core/end2end/fixtures/h2_full+workarounds.c \

H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(H2_FULL+WORKAROUNDS_NOSEC_TEST_SRC))))


$(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test: $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) -o $(BINDIR)/$(CONFIG)/h2_full+workarounds_nosec_test

$(OBJDIR)/$(CONFIG)/test/core/end2end/fixtures/h2_full+workarounds.o: $(LIBDIR)/$(CONFIG)/libend2end_nosec_tests.a $(LIBDIR)/$(CONFIG)/libgrpc_test_util_unsecure.a $(LIBDIR)/$(CONFIG)/libgrpc_unsecure.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a

deps_h2_full+workarounds_nosec_test: $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS:.o=.dep)

ifneq ($(NO_DEPS),true)
-include $(H2_FULL+WORKAROUNDS_NOSEC_TEST_OBJS:.o=.dep)
endif


H2_HTTP_PROXY_NOSEC_TEST_SRC = \
test/core/end2end/fixtures/h2_http_proxy.c \

Expand Down
2 changes: 2 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,8 @@
'src/core/ext/census/tracing.c',
'src/core/ext/filters/max_age/max_age_filter.c',
'src/core/ext/filters/message_size/message_size_filter.c',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c',
'src/core/ext/filters/workarounds/workaround_utils.c',
'src/core/plugin_registry/grpc_plugin_registry.c',
],
"conditions": [
Expand Down
21 changes: 21 additions & 0 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ filegroups:
- include/grpc/support/tls_msvc.h
- include/grpc/support/tls_pthread.h
- include/grpc/support/useful.h
- include/grpc/support/workaround_list.h
headers:
- src/core/lib/profiling/timers.h
- src/core/lib/support/arena.h
Expand Down Expand Up @@ -658,6 +659,13 @@ filegroups:
- grpc_base
- grpc_transport_chttp2_alpn
- tsi
- name: grpc_server_backward_compatibility
headers:
- src/core/ext/filters/workarounds/workaround_utils.h
src:
- src/core/ext/filters/workarounds/workaround_utils.c
uses:
- grpc_base
- name: grpc_test_util_base
build: test
headers:
Expand Down Expand Up @@ -824,6 +832,15 @@ filegroups:
- grpc_base
- grpc_transport_chttp2
- grpc_http_filters
- name: grpc_workaround_cronet_compression_filter
headers:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h
src:
- src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c
plugin: grpc_workaround_cronet_compression_filter
uses:
- grpc_base
- grpc_server_backward_compatibility
- name: nanopb
headers:
- third_party/nanopb/pb.h
Expand Down Expand Up @@ -1053,6 +1070,8 @@ libs:
- grpc_max_age_filter
- grpc_message_size_filter
- grpc_deadline_filter
- grpc_workaround_cronet_compression_filter
- grpc_server_backward_compatibility
generate_plugin_registry: true
secure: true
vs_packages:
Expand Down Expand Up @@ -1152,6 +1171,8 @@ libs:
- grpc_max_age_filter
- grpc_message_size_filter
- grpc_deadline_filter
- grpc_workaround_cronet_compression_filter
- grpc_server_backward_compatibility
generate_plugin_registry: true
secure: false
vs_project_guid: '{46CEDFFF-9692-456A-AA24-38B5D6BCF4C5}'
Expand Down
3 changes: 3 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/census/tracing.c \
src/core/ext/filters/max_age/max_age_filter.c \
src/core/ext/filters/message_size/message_size_filter.c \
src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c \
src/core/ext/filters/workarounds/workaround_utils.c \
src/core/plugin_registry/grpc_plugin_registry.c \
src/boringssl/err_data.c \
third_party/boringssl/crypto/aes/aes.c \
Expand Down Expand Up @@ -711,6 +713,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/load_reporting)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/max_age)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/message_size)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/workarounds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/alpn)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/client/insecure)
Expand Down
9 changes: 8 additions & 1 deletion gRPC-Core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ Pod::Spec.new do |s|
'include/grpc/support/tls_msvc.h',
'include/grpc/support/tls_pthread.h',
'include/grpc/support/useful.h',
'include/grpc/support/workaround_list.h',
'include/grpc/impl/codegen/atm.h',
'include/grpc/impl/codegen/atm_gcc_atomic.h',
'include/grpc/impl/codegen/atm_gcc_sync.h',
Expand Down Expand Up @@ -473,6 +474,8 @@ Pod::Spec.new do |s|
'src/core/ext/census/tracing.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h',
'src/core/lib/surface/init.c',
'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c',
Expand Down Expand Up @@ -717,6 +720,8 @@ Pod::Spec.new do |s|
'src/core/ext/census/tracing.c',
'src/core/ext/filters/max_age/max_age_filter.c',
'src/core/ext/filters/message_size/message_size_filter.c',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.c',
'src/core/ext/filters/workarounds/workaround_utils.c',
'src/core/plugin_registry/grpc_plugin_registry.c'

ss.private_header_files = 'src/core/lib/profiling/timers.h',
Expand Down Expand Up @@ -950,7 +955,9 @@ Pod::Spec.new do |s|
'src/core/ext/census/trace_string.h',
'src/core/ext/census/tracing.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h'
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h'
end

s.subspec 'Cronet-Interface' do |ss|
Expand Down
Loading

0 comments on commit a2d9d48

Please sign in to comment.