Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the purpose of proto_path in the protoc command

My bash script has the following code generate invocation for "Protocol Buffers".

protoc --proto_path=src --java_out=src 
src/com/domain/project/persistentThing.proto

That was from 2012. Today the online documentation for Java Protocol Buffers says:

protoc -I=$SRC_DIR --java_out=$DST_DIR 
$SRC_DIR/addressbook.proto

This makes it seem like --proto_path is superceded. What was the purpose of --proto_path?

like image 343
H2ONaCl Avatar asked Mar 12 '23 08:03

H2ONaCl


1 Answers

-I and --proto_path are the same flag: -I is the shorthand version.

The purpose of the flag is to specify a directory in which to look for imported files, much like the C compiler's -I flag, Java's CLASSPATH environment variable, Python's PYTHONPATH, etc. You may specify multiple directories by passing multiple -I flags; they will be searched in order.

like image 168
Kenton Varda Avatar answered Mar 23 '23 20:03

Kenton Varda