1protoc(1) User Commands protoc(1)
2
3
4
6 protoc - Protobuf compiler
7
9 protoc [OPTION] PROTO_FILES
10
12 Parse PROTO_FILES and generate output based on the options given.
13
15 -IPATH, --proto_path=PATH
16 Specify the directory in which to search for imports. May be
17 specified multiple times; directories will be searched in order.
18 If not given, the current working directory is used. If not
19 found in any of the these directories, the --descriptor_set_in
20 descriptors will be checked for required proto file.
21
22 --version
23 Show version info and exit.
24
25 -h, --help
26 Show a help message and exit.
27
28 --encode=MESSAGE_TYPE
29 Read a text-format message of the given type from standard input
30 and write it in binary to standard output. The message type
31 must be defined in PROTO_FILES or their imports.
32
33 --deterministic_output
34 When using --encode, ensure map fields are deterministically or‐
35 dered. Note that this order is not canonical, and changes
36 across builds or releases of protoc(1).
37
38 --decode=MESSAGE_TYPE
39 Read a binary message of the given type from standard input and
40 write it in text format to standard output. The message type
41 must be defined in PROTO_FILES or their imports.
42
43 --decode_raw
44 Read an arbitrary protocol message from standard input and write
45 the raw tag/value pairs in text format to standard output. No
46 PROTO_FILES should be given when using this flag.
47
48 --descriptor_set_in=FILES
49 Specifies a delimited list of FILES each containing a
50 FileDescriptorSet (a protocol buffer defined in descrip‐
51 tor.proto). The FileDescriptor for each of the PROTO_FILES pro‐
52 vided will be loaded from these FileDescriptorSets. If a
53 FileDescriptor appears multiple times, the first occurrence will
54 be used.
55
56 -oFILE, --descriptor_set_out=FILE
57 Writes a FileDescriptorSet (a protocol buffer, defined in de‐
58 scriptor.proto) containing all of the input files to FILE.
59
60 --include_imports
61 When using --descriptor_set_out, also include all dependencies
62 of the input files in the set, so that the set is self-con‐
63 tained.
64
65 --include_source_info
66 When using --descriptor_set_out, do not strip SourceCodeInfo
67 from the FileDescriptorProto. This results in vastly larger de‐
68 scriptors that include information about the original location
69 of each decl in the source file as well as surrounding comments.
70
71 --dependency_out=FILE
72 Write a dependency output file in the format expected by
73 make(1). This writes the transitive set of input file paths to
74 FILE
75
76 --error_format=FORMAT
77 Set the format in which to print errors. FORMAT may be ‘gcc’
78 (the default) or (Microsoft Visual Studio format).
79
80 --fatal_warnings
81 Make warnings be fatal (similar to -Werr in gcc(1)). This flag
82 will make protoc(1)
83 return with a non-zero exit code if any warnings are generated.
84
85 --print_free_field_numbers
86 Print the free field numbers of the messages defined in the
87 given proto files. Groups share the same field number space
88 with the parent message. Extension ranges are counted as occu‐
89 pied fields numbers.
90
91 --plugin=EXECUTABLE
92 Specifies a plugin executable to use. Normally, protoc(1)
93 searches the PATH for plugins, but you may specify additional
94 executables not in the path using this flag. Additionally, EXE‐
95 CUTABLE may be of the form NAME=PATH, in which case the given
96 plugin name is mapped to the given executable even if the exe‐
97 cutable’s own name differs.
98
99 --cpp_out=OUT_DIR
100 Generate C++ header and source.
101
102 --csharp_out=OUT_DIR
103 Generate C# source file.
104
105 --java_out=OUT_DIR
106 Generate Java source file.
107
108 --js_out=OUT_DIR
109 Generate JavaScript source.
110
111 --kotlin_out=OUT_DIR
112 Generate Kotlin file.
113
114 --objc_out=OUT_DIR
115 Generate Objective-C header and source.
116
117 --php_out=OUT_DIR
118 Generate PHP source file.
119
120 --python_out=OUT_DIR
121 Generate Python source file.
122
123 --ruby_out=OUT_DIR
124 Generate Ruby source file.
125
126 @<filename>
127 Read options and filenames from file. If a relative file path
128 is specified, the file will be searched in the working direc‐
129 tory. The --proto_path option will not affect how this argument
130 file is searched. Content of the file will be expanded in the
131 position of @<filename> as in the argument list. Note that
132 shell expansion is not applied to the content of the file (i.e.,
133 you cannot use quotes, wildcards, escapes, commands, etc.).
134 Each line corresponds to a single argument, even if it contains
135 spaces.
136
138 make(1), gcc(1)
139
140
141
142protoc December 2022 protoc(1)