block-sdk/scripts/protocgen.sh
2023-02-23 13:38:13 -05:00

27 lines
754 B
Bash
Executable File

#!/usr/bin/env bash
# How to run manually:
# docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools"
# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh
set -e
echo "Generating Protocol Buffer code..."
cd proto
proto_dirs=$(find ./pob -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 go_package $file &> /dev/null ; then
buf generate --template buf.gen.gogo.yaml $file
fi
done
done
cd ..
# move proto files to the right places
cp -r github.com/skip-mev/pob/* ./
rm -rf github.com
# go mod tidy --compat=1.20