tooling for generating protos

This commit is contained in:
William Banfield
2022-03-03 09:54:41 -05:00
parent 7c4fe5b108
commit d37e8b47ec
4 changed files with 124 additions and 89 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -euo pipefail
# By default, this script runs against the latest commit to the master branch
# in the Tendermint spec repository. To use this script with a different version
# of the spec repository, run it with the $VERS environment variable set to the
# desired branch name or commit hash from the spec repo.
MODNAME="$(go list -m)"
find ./proto/tendermint -name '*.proto' -not -path "./proto/tendermint/abci/types.proto" \
-exec sh ./scripts/protopackage.sh {} "$MODNAME" ';'
# For historical compatibility, the abci file needs to get a slightly different import name
# so that it can be moved into the ./abci/types directory.
sh ./scripts/protopackage.sh ./proto/tendermint/abci/types.proto $MODNAME "abci/types"
make proto-gen
mv ./proto/tendermint/abci/types.pb.go ./abci/types
echo "proto files have been compiled"
echo "removing copied files"
find proto/tendermint/ -name '*.proto' -not -path "proto/tendermint/abci/types.proto" -not -path "proto/tendermint/types/types.proto" \
| xargs -I {} git checkout {}
find proto/tendermint/ -name '*.pb.go' -not -path "proto/tendermint/abci/types.pb.go" -not -path "proto/tendermint/types/types.pb.go" \
| xargs -I {} git checkout {}