mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-02 20:15:34 +00:00
[gRPC] Update the code generator for Python to produce typed handlers (#8326)
* Move `namer.h` and `idl_namer.h` to `include/codegen` so they can be reused from `grpc` dirqectory. * [gRPC] Update the Python generator to produce typed handlers and Python stubs if requested. * [gRPC] Document the newly added compiler flags.
This commit is contained in:
@@ -268,6 +268,8 @@ const static FlatCOption flatc_options[] = {
|
||||
{ "", "grpc-use-system-headers", "",
|
||||
"Use <> for headers included from the generated code." },
|
||||
{ "", "grpc-search-path", "PATH", "Prefix to any gRPC includes." },
|
||||
{ "", "grpc-python-typed-handlers", "",
|
||||
"The handlers will use the generated classes rather than raw bytes." },
|
||||
};
|
||||
|
||||
auto cmp = [](FlatCOption a, FlatCOption b) { return a.long_opt < b.long_opt; };
|
||||
@@ -720,6 +722,12 @@ FlatCOptions FlatCompiler::ParseFromCommandLineArguments(int argc,
|
||||
} else if (arg == "--no-grpc-use-system-headers" ||
|
||||
arg == "--grpc-use-system-headers=false") {
|
||||
opts.grpc_use_system_headers = false;
|
||||
} else if (arg == "--grpc-python-typed-handlers" ||
|
||||
arg == "--grpc-python-typed-handlers=true") {
|
||||
opts.grpc_python_typed_handlers = true;
|
||||
} else if (arg == "--no-grpc-python-typed-handlers" ||
|
||||
arg == "--grpc-python-typed-handlers=false") {
|
||||
opts.grpc_python_typed_handlers = false;
|
||||
} else {
|
||||
if (arg == "--proto") { opts.proto_mode = true; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user