diff options
author | Esun Kim <veblush@gmail.com> | 2021-07-29 17:41:51 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 10:41:51 -0700 |
commit | e012054667cd78a02c7c373d1bfecbfb7d091cd8 (patch) | |
tree | b65ed3887c589285e0cd66c0e70fd84121d15b43 /grpc | |
parent | 5235133f321b71f041b515002d3c8f7049f497de (diff) | |
download | flatbuffers-e012054667cd78a02c7c373d1bfecbfb7d091cd8.tar.gz flatbuffers-e012054667cd78a02c7c373d1bfecbfb7d091cd8.tar.bz2 flatbuffers-e012054667cd78a02c7c373d1bfecbfb7d091cd8.zip |
[C++] Use proper gRPC C++ API when using MemoryBuffer Slice (#6756)
* Use ByteBuffer
* Use Slice
* Upgrade gRPC to 1.39.0
* Update gRPC build script
* Reformat
* Added CMAKE_CXX_STANDARD=11 when building Abseil
* Enabled ABSL_ENABLE_INSTALL
* Added absl to grpctest deps
Diffstat (limited to 'grpc')
-rw-r--r-- | grpc/README.md | 5 | ||||
-rwxr-xr-x | grpc/build_grpc.sh | 9 | ||||
-rw-r--r-- | grpc/tests/message_builder_test.cpp | 9 |
3 files changed, 8 insertions, 15 deletions
diff --git a/grpc/README.md b/grpc/README.md index 685003f9..f46258fc 100644 --- a/grpc/README.md +++ b/grpc/README.md @@ -32,9 +32,8 @@ $bazel test src/compiler/... ### Linux -1. `ln -s ${GRPC_INSTALL_PATH}/lib/libgrpc++_unsecure.so.6 ${GRPC_INSTALL_PATH}/lib/libgrpc++_unsecure.so.1` -2. `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GRPC_INSTALL_PATH}/lib` -3. `make test ARGS=-V` +1. `export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GRPC_INSTALL_PATH}/lib` +2. `make test ARGS=-V` For Bazel users: diff --git a/grpc/build_grpc.sh b/grpc/build_grpc.sh index 190a1ef9..49c5a60f 100755 --- a/grpc/build_grpc.sh +++ b/grpc/build_grpc.sh @@ -1,11 +1,11 @@ #!/bin/bash -grpc_1_36_0_githash=736e3758351ced3cd842bad3ba4e2540f01bbc48 +grpc_1_39_0_githash=58602e20a3f3e48f24a4114c757099b25b947f7b function build_grpc () { git clone https://github.com/grpc/grpc.git google/grpc cd google/grpc - git checkout ${grpc_1_36_0_githash} + git checkout ${grpc_1_39_0_githash} git submodule update --init # Apply boringssl build patch cd third_party/boringssl-with-bazel @@ -13,11 +13,8 @@ function build_grpc () { cd ../.. mkdir ../grpc_build cd ../grpc_build - cmake ../grpc -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=`pwd`/../grpc/install + cmake ../grpc -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DABSL_ENABLE_INSTALL=ON -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=`pwd`/../grpc/install cmake --build . --target install ${JOBS:+-j$JOBS} - if [ ! -f ${GRPC_INSTALL_PATH}/lib/libgrpc++_unsecure.so.1 ]; then - ln -s ${GRPC_INSTALL_PATH}/lib/libgrpc++_unsecure.so.6 ${GRPC_INSTALL_PATH}/lib/libgrpc++_unsecure.so.1 - fi cd ../.. } diff --git a/grpc/tests/message_builder_test.cpp b/grpc/tests/message_builder_test.cpp index 3ce33a98..8af0c214 100644 --- a/grpc/tests/message_builder_test.cpp +++ b/grpc/tests/message_builder_test.cpp @@ -28,7 +28,7 @@ void builder_move_assign_after_releaseraw_test( auto root_offset1 = populate1(dst); dst.Finish(root_offset1); size_t size, offset; - grpc_slice slice; + ::grpc::Slice slice; dst.ReleaseRaw(size, offset, slice); flatbuffers::FlatBufferBuilder src; auto root_offset2 = populate2(src); @@ -39,7 +39,6 @@ void builder_move_assign_after_releaseraw_test( TEST_EQ(dst.GetSize(), src_size); TEST_ASSERT(release_n_verify(dst, m2_name(), m2_color())); TEST_EQ(src.GetSize(), 0); - grpc_slice_unref(slice); } template<class SrcBuilder> @@ -82,10 +81,9 @@ struct BuilderReuseTests<flatbuffers::grpc::MessageBuilder, SrcBuilder> { auto root_offset1 = populate1(mb); mb.Finish(root_offset1); size_t size, offset; - grpc_slice slice; + ::grpc::Slice slice; const uint8_t *buf = mb.ReleaseRaw(size, offset, slice); TEST_ASSERT_FUNC(verify(buf, offset, m1_name(), m1_color())); - grpc_slice_unref(slice); } } @@ -146,10 +144,9 @@ struct BuilderReuseTests<flatbuffers::grpc::MessageBuilder, SrcBuilder> { auto root_offset1 = populate1(dst); dst.Finish(root_offset1); size_t size, offset; - grpc_slice slice = grpc_empty_slice(); + ::grpc::Slice slice; const uint8_t *buf = dst.ReleaseRaw(size, offset, slice); TEST_ASSERT_FUNC(verify(buf, offset, m1_name(), m1_color())); - grpc_slice_unref(slice); SrcBuilder src; dst = std::move(src); |