I have several nested directories, each containing proto files, and many of the proto files have dependencies on the other protos located somewhere within the root directory. I'm using this script to try to compile them, and executing it from a directory that contains both the folder with the protos and the folder where I want my compiled proto classes to go. One of the issues I'm having now is that I'm getting a protoc: command not found
error.
set -e
BASEDIR="$(greadlink -f $(dirname $0))"
PROTO_DIR="$BASEDIR/new-protos-aug/"
SWIFTPROTO_DIR="$BASEDIR/new-swift-protos-aug/"
echo "Converting files from $PROTO_DIR to $SWIFTPROTO_DIR"
FILES=$(find new-protos-aug -type f -name "*.proto")
for proto in $FILES; do
PATH=${proto///[^ ]*\.proto/};
PROTO_DIR="$BASEDIR/$PATH/"
protoc -I=$PROTO_DIR --swift_out=$SWIFTPROTO_DIR $proto;
done
Any ideas on how best to do this?
Forgot to post how I resolved this. This did the trick (basically just listing every possible subdirectory with -I)