protocol-buffers: fully qualified import names

Viewed 6

While reading https://developers.google.com/protocol-buffers/docs/proto I ran into the following piece of text:

The protocol compiler searches for imported files in a set of directories specified on the protocol compiler command line using the -I/--proto_path flag. If no flag was given, it looks in the directory in which the compiler was invoked. In general you should set the --proto_path flag to the root of your project and use fully qualified names for all imports.

What exactly do they mean that --proto_path should point at the root of the project, and use fully-qualified import names?

For example my project tree has the following structure:

$HOME/
    my_project/
       docs/
       src/
       lib/
       proto/
         p1.proto
         p2.proto

proto is where I keep .proto schemas. So for the above layout I should call protoc as --proto_path=$HOME/my_project/proto ? Not sure what should import look like?

0 Answers
Related