Grpc protoc生成工具命令笔记

 

1:-IPATH, --proto_path=PATH  

    原文说明: Specify the directory in which to search for imports.  May be specified multiple times;directories will be searched in order.  If not given, the current working directory is used.
If not found in any of the these directories,the --descriptor_set_in descriptors will be checked for required proto file.

    翻译:指定要在其中搜索导入的目录。可以多次指定;将按顺序搜索目录。如果未给定,则使用当前工作目录。若在这些目录中找不到任何一个,

将检查描述符中的--descriptor_set_in 获取所需的proto文件。


 2: --version                  

     Show version info and exit.
 3: -h, --help                 

    Show this text and exit.

4:--encode=MESSAGE_TYPE      

   原文说明:Read a text-format message of the given type from standard input and write it in binary to standard output.  The message type must be defined in PROTO_FILES or their imports.

   翻译:从标准输入读取给定类型的文本格式消息,并将其以二进制形式写入标准输出。消息类型必须在PROTO_FILES或其导入中定义。


5:--decode=MESSAGE_TYPE      

原文说明:Read a binary message of the given type from standard input and write it in text format to standard output.  The message type must be defined in PROTO_FILES or their imports.

翻译:从标准输入读取给定类型的二进制消息,并将其以文本格式写入标准输出。消息类型必须在PROTO_FILES或其导入中定义。


 6: --decode_raw               

原文说明:Read an arbitrary protocol message fromstandard input and write the raw tag/value pairs in text format to standard output.  No PROTO_FILES should be given when using this flag.

翻译:从标准输入读取任意协议消息,并以文本格式将原始标记/值对写入标准输出。使用此标志时不应给出任何PROTO_FILES。


 7: --descriptor_set_in=FILES  

   原文说明:  Specifies a delimited list of FILES each containing a FileDescriptorSet (a protocol buffer defined in descriptor.proto).The FileDescriptor for each of the PROTO_FILES provided will be loaded from these FileDescriptorSets. If a FileDescriptor appears multiple times, the first occurrence will be used.

 翻译:指定一个文件的分隔列表,每个文件都包含一个文件描述符集(在descriptor.proto中定义的协议缓冲区)文件描述符。如果文件描述符多次出现,则将使用第一次出现的文件描述符。


 8:-oFILE,                    

原文说明: Writes a FileDescriptorSet (a protocol buffer,defined in descriptor.proto) containing all of   the input files to FILE.

 翻译:写入文件描述符集(协议缓冲区,--descriptor_set_out=在descriptor.proto)中定义的文件,包含要归档的输入文件。
    --descriptor_set_out=FILE
                           
9:--include_imports          

    原文说明:When using --descriptor_set_out, also includeall dependencies of the input files in the set, so that the set is self-contained.

    翻译:当使用--descriptor_set_out时,还包括集合中输入文件的依赖项,以便集合是自包含的。


10:--include_source_info      

  原文说明:When using --descriptor_set_out, do not strip SourceCodeInfo from the FileDescriptorProto.This results in vastly larger descriptors that include information about the original
 location of each decl in the source file as well as surrounding comments.

  翻译:当使用--descriptor_-set_-out时,不要从文件描述符Proto中删除源代码信息。这会导致更大的描述符,其中包括源文件中每个decl的原始位置信息以及周围的注释。


 11: --dependency_out=FILE      

原文说明: Write a dependency output file in the format expected by make. This writes the transitive set of input file paths to FILE

翻译:  以make所期望的格式编写依赖项输出文件。这将输入文件路径的可传递集写入文件


12: --error_format=FORMAT      

 原文说明:Set the format in which to print errors. FORMAT may be 'gcc' (the default) or 'msvs' (Microsoft Visual Studio format).

翻译:设置打印错误的格式。格式可以是“gcc”(默认)或“msvs”(Microsoft Visual Studio格式)。


13:  --print_free_field_numbers 

  原文说明:Print the free field numbers of the messages defined in the given proto files. Groups share the same field number space with the parent message.

Extension ranges are counted as occupied fields numbers.

 翻译:打印给定proto文件中定义的消息的可用字段号。组与父邮件共享相同的字段号空间。扩展范围计算为占用字段编号。

 14: --plugin=EXECUTABLE     

   原文说明:Specifies a plugin executable to use.Normally, protoc searches the PATH for plugins, but you may specify additional executables not in the path using this flag.
Additionally, EXECUTABLE may be of the form NAME=PATH, in which case the given plugin name is mapped to the given executable even if the executable's own name differs.

   翻译:指定要使用的插件可执行文件。通常,protoc会在路径中搜索插件,但您可以使用此标志指定不在路径中的其他可执行文件。
此外,可执行文件的格式可以是NAME=PATH,在这种情况下,即使可执行文件的自身名称不同,给定的插件名称也映射到给定的可执行文件。

15:
  --cpp_out=OUT_DIR           Generate C++ header and source.
  --csharp_out=OUT_DIR        Generate C# source file.
  --java_out=OUT_DIR          Generate Java source file.
  --js_out=OUT_DIR            Generate JavaScript source.
  --objc_out=OUT_DIR          Generate Objective C header and source.
  --php_out=OUT_DIR           Generate PHP source file.
  --python_out=OUT_DIR        Generate Python source file.
  --ruby_out=OUT_DIR          Generate Ruby source file.


 16: @<filename>               

   Read options and filenames from file. If a relative file path is specified, the file will be searched in the working directory.The --proto_path option will not affect how
this argument file is searched. Content of the file will be expanded in the position of @<filename> as in the argument list. Note that shell expansion is not applied to the
content of the file (i.e., you cannot use quotes, wildcards, escapes, commands, etc.). Each line corresponds to a single argument, even if it contains spaces.

从文件中读取选项和文件名。如果指定了相对文件路径,则将在工作目录中搜索该文件已搜索此参数文件。文件的内容将在参数列表中@<filename>的位置展开。注意,shell扩展不适用于

文件内容(即,不能使用引号、通配符、转义符、命令等)。每一行对应一个参数,即使它包含空格。

 

 

示例:

protoc -I F:\C#\202002\ConsoleApp1\GrpcGen --csharp_out=F:\C#\202002\ConsoleApp1\GrpcGen --grpc_out F:\C#\202002\ConsoleApp1\GrpcGen --plugin=protoc-gen-grpc=grpc_csharp_plugin.exe HelloWorld.proto

 

posted @ 2020-02-17 10:56  微若思丢丢  阅读(1792)  评论(0编辑  收藏  举报