-
Notifications
You must be signed in to change notification settings - Fork 2
Compile ProtoBuf Definitions
https://google.github.io/proto-lens/installing-protoc.html
protoc --python_out=. addressbook.proto
To ensure that all dependencies and .proto
files are embedded into a single file, use the following protoc
command:
protoc --include_source_info --include_imports --descriptor_set_out=descriptor.pb $(PROTO_FILES)
-
...
indicates any additional options you were using previously. -
$(PROTO_FILES)
represents the list of all the.proto
files.
By executing the above command, you'll obtain a single .pb
file containing all the compiled .proto
files along with their dependencies. This approach is highly convenient to avoid frequent file modifications.
The --include_imports
option in protoc
(Protocol Buffers Compiler) ensures that all import statements in a .proto
file are included in the output when generating a descriptor set file. This is especially beneficial when you aim to encompass all dependencies of a .proto
file in the descriptor set, rather than just the file itself.
Note: protoc
can accept multiple ".proto" files simultaneously as arguments. All the files provided as arguments will be incorporated into the generated file descriptor. This feature is particularly advantageous for embedding all dependencies of a .proto
file in the descriptor set.