如何使用一个命令从多个目录编译多个 proto 文件
How to compile multiple proto files with one command from multiple directories
我有以下结构:
根文件夹/
foldA
A1.proto
foldB
B1.proto
foldC
C1.proto
我尝试的是:
for /r %g in (*.proto) do protoc -I=rootfolder --python_out=. %g
理想情况下,我希望将它们全部编译到根文件夹级别的名为 protos 的文件夹中。我也不能对它们进行硬编码,因为我应该执行一个命令来编译将来添加的其他原型文件。
我的命令出现的错误是:
<full_path_to_proto_file> File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file name -- protoc is too dumb to figure out when two paths (eg absolute and relative) are equivalent.
感谢评论区的好心用户post
for /D %J in ("rootfolder\*") do for %I in ("%~J\*.proto") do protoc --proto_path="%~dpI." --python_out="protos" "%~nxI"
我有以下结构:
根文件夹/
foldA
A1.proto
foldB
B1.proto
foldC
C1.proto
我尝试的是:
for /r %g in (*.proto) do protoc -I=rootfolder --python_out=. %g
理想情况下,我希望将它们全部编译到根文件夹级别的名为 protos 的文件夹中。我也不能对它们进行硬编码,因为我应该执行一个命令来编译将来添加的其他原型文件。 我的命令出现的错误是:
<full_path_to_proto_file> File does not reside within any path specified using --proto_path (or -I). You must specify a --proto_path which encompasses this file. Note that the proto_path must be an exact prefix of the .proto file name -- protoc is too dumb to figure out when two paths (eg absolute and relative) are equivalent.
感谢评论区的好心用户post
for /D %J in ("rootfolder\*") do for %I in ("%~J\*.proto") do protoc --proto_path="%~dpI." --python_out="protos" "%~nxI"