Grpc protoc generation tool command notes

 

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.

    Translation: Specify the directory in which to search import. You can specify multiple times; in sequence search directory. If not given, the current working directory. If can not find any of these directories,

Checks descriptor --descriptor_set_in proto obtain the required file.


 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.

   Translation: reads from the standard input a given type of message text format, and writes it to standard output in binary form. PROTO_FILES message type must be defined or import.


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.

Translation: reads from the standard input binary message of a given type, and writes it to standard output in text format. PROTO_FILES message type must be defined or import.


 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.

Translation: read any message protocol from the standard input, and the original text format tag / value pairs written to standard output. We should not give any PROTO_FILES when using this flag.


 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.

 Translation: Specify a file-separated list of each file contains a file descriptor set (as defined in the protocol buffers in descriptor.proto) file descriptor. If the file descriptor appears more than once, the first occurrence of a file descriptor will be used.


 8: -oFILE ,                    

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

 Translation: write file descriptor set (protocol buffers, - descriptor_set_out = in descriptor.proto) file defined, contains the input files to be archived.
    --descriptor_set_out = the 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.

    Translation: When using --descriptor_set_out, further comprising a dependency input file in the collection, so that a set of self-contained.


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.

  Translation: When using --descriptor_-set_-out, do not delete the information from the source code in the file descriptor Proto. This leads to greater descriptors, including comments for each source file and the location information of the original decl around.


 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

Translation: writing to make the desired format of output file dependency. This input file path may be set to write the file transfer


12: --error_format=FORMAT      

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

Translation: Set to print the wrong format. Format may be "gcc" (default) or "msvs" (Microsoft Visual Studio format).


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.

 Translation: print the given message file proto defined number of available fields. Group share the same space and the number of fields parent message. Extended range calculation to occupy the field number.

 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.

   Translation: I want to use the plug-in executable files. Usually, protoc searches for plug-in path, but you can use this flag to specify other executable file is not in the path.
Further, the executable format file may be NAME = PATH, in this case, even if the name of the executable file itself different, the given name of the plug are also mapped to a given executable.

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.

Read options and file name from the file. If a relative file path is specified, the search for the file in the working directory has been searching for this parameter file. The contents of the file @ <filename> in the deployed position in the parameter list. Note that, the shell does not apply to the extended

file contents (i.e., can not use quotation marks, wildcard, escape, commands, etc.). Each row corresponds to a parameter, even if it contains spaces.

 

 

Example:

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

 

Guess you like

Origin www.cnblogs.com/wzt2019l/p/12252571.html