2024-02-01 04:48:40 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-02-01 10:58:34 +00:00
|
|
|
# Enter the proto files dir
|
2024-02-01 04:48:40 +00:00
|
|
|
cd proto
|
2024-02-01 10:58:34 +00:00
|
|
|
|
|
|
|
echo "Generating gogo proto code"
|
2024-02-01 04:48:40 +00:00
|
|
|
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
|
2024-04-01 09:57:26 +00:00
|
|
|
# Check if the go_package in the file is pointing to laconicd
|
|
|
|
if grep -q "option go_package.*laconicd" "$file"; then
|
2024-02-01 10:58:34 +00:00
|
|
|
buf generate --template buf.gen.gogo.yaml "$file"
|
2024-02-01 04:48:40 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "Generating pulsar proto code"
|
|
|
|
buf generate --template buf.gen.pulsar.yaml
|
|
|
|
|
2024-02-01 10:58:34 +00:00
|
|
|
# Go back to root dir
|
2024-02-01 04:48:40 +00:00
|
|
|
cd ..
|
|
|
|
|
2024-02-01 10:58:34 +00:00
|
|
|
# Copy over the generated files and cleanup
|
2024-04-01 09:57:26 +00:00
|
|
|
cp -r git.vdb.to/cerc-io/laconicd/* ./
|
2024-02-01 10:58:34 +00:00
|
|
|
rm -rf git.vdb.to
|
|
|
|
|
|
|
|
go mod tidy
|