chore: Setup Scaffolding for Protobuf (#1)

This commit is contained in:
Aleksandr Bezobchuk
2023-02-23 13:38:13 -05:00
committed by GitHub
parent 5b6c7a6203
commit 0f7c95dbf7
9 changed files with 601 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/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