forked from lavanet/lava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protocgen.sh
executable file
·36 lines (29 loc) · 928 Bytes
/
protocgen.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env /bin/sh
__dir=$(dirname "$0")
. $__dir/useful_commands.sh
if ! command_exists buf; then
echo "buf not found."
echo "Please install buf using the init_install.sh script or manually."
exit 1
fi
if ! command_exists protoc-gen-gocosmos; then
echo "protoc-gen-gocosmos not found."
echo "Please install protoc-gen-gocosmos using the init_install.sh script or manually."
exit 1
fi
set -e
echo "Generating gogo proto code"
cd proto
proto_dirs=$(find . -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
if grep -q "option go_package" $file 2> /dev/null ; then
echo "Generating gogo proto code for $file"
buf generate --template buf.gen.gogo.yaml $file
fi
done
done
cd ..
# move proto files to the right places
cp -r github.com/lavanet/lava/* ./
rm -rf github.com