[gRPC] Add new options to control the gRPC code generation. (#8298)

The new options are:

-  `--grpc-filename-suffix` controls the suffix of the generated files;
-  `--grpc-use-system-headers` controls the type of C++ includes generated;
-  `--grpc-search-path` controls the directory that contains gRPC runtime;
-  `--grpc-additional-header` allows to provide additional dependencies for the generated code.
This commit is contained in:
Anton Bobukh
2024-05-15 08:17:40 -07:00
committed by GitHub
parent c696275eaf
commit 150644d7f4
5 changed files with 73 additions and 12 deletions

View File

@@ -22,6 +22,7 @@
#include <map>
#include <memory>
#include <stack>
#include <vector>
#include "flatbuffers/base.h"
#include "flatbuffers/flatbuffers.h"
@@ -759,6 +760,12 @@ struct IDLOptions {
// make the flatbuffer more compact.
bool set_empty_vectors_to_null;
/*********************************** gRPC ***********************************/
std::string grpc_filename_suffix;
bool grpc_use_system_headers;
std::string grpc_search_path;
std::vector<std::string> grpc_additional_headers;
IDLOptions()
: gen_jvmstatic(false),
use_flexbuffers(false),
@@ -829,7 +836,9 @@ struct IDLOptions {
rust_module_root_file(false),
lang_to_generate(0),
set_empty_strings_to_null(true),
set_empty_vectors_to_null(true) {}
set_empty_vectors_to_null(true),
grpc_filename_suffix(".fb"),
grpc_use_system_headers(true) {}
};
// This encapsulates where the parser is in the current source file.