mirror of
https://github.com/google/flatbuffers.git
synced 2025-04-09 00:12:15 +08:00
* grpc/compiler: Respect filename suffix and extension during code generation grpc compiler is not respecting filename suffix and extension passed to flatc CLI. This causes compiler to spit out incorrect code, which then cannot be compiled without modification. Following patch fixes the problem. Note, I ended up removing some code introduced #6954 ("Have grpc include file with correct filename-suffix given to flatc") in favour of keeping sanity of the generator code. Signed-off-by: Aman Priyadarshi <aman.eureka@gmail.com> * tests: Add filename-suffix and filename-ext test files * Test 1: Filename extension changed to "hpp". * Test 2: Filename suffix changed to "_suffix". * Test 3: Filename extension changed to "hpp" and suffix changed to "_suffix" Signed-off-by: Aman Priyadarshi <aman.eureka@gmail.com>
GRPC implementation and test
NOTE: files in src/
are shared with the GRPC project, and maintained there
(any changes should be submitted to GRPC instead). These files are copied
from GRPC, and work with both the Protobuf and FlatBuffers code generator.
tests/
contains a GRPC specific test, you need to have built and installed
the GRPC libraries for this to compile. This test will build using the
FLATBUFFERS_BUILD_GRPCTEST
option to the main FlatBuffers CMake project.
Building Flatbuffers with gRPC
Linux
- Download, build and install gRPC. See instructions.
- Lets say your gRPC clone is at
/your/path/to/grpc_repo
. - Install gRPC in a custom directory by running
make install prefix=/your/path/to/grpc_repo/install
.
- Lets say your gRPC clone is at
export GRPC_INSTALL_PATH=/your/path/to/grpc_repo/install
export PROTOBUF_DOWNLOAD_PATH=/your/path/to/grpc_repo/third_party/protobuf
mkdir build ; cd build
cmake -DFLATBUFFERS_BUILD_GRPCTEST=ON -DGRPC_INSTALL_PATH=${GRPC_INSTALL_PATH} -DPROTOBUF_DOWNLOAD_PATH=${PROTOBUF_DOWNLOAD_PATH} ..
make
For Bazel users:
$bazel test src/compiler/...
Running FlatBuffer gRPC tests
Linux
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${GRPC_INSTALL_PATH}/lib
make test ARGS=-V
For Bazel users:
$bazel test tests/...