scripts fixes

This commit is contained in:
William Banfield
2021-11-12 12:33:04 -05:00
parent ff41f0849b
commit 27747dd797
2 changed files with 7 additions and 19 deletions

View File

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
set -eo 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
@@ -23,7 +23,7 @@ curl -qL "https://api.github.com/repos/tendermint/spec/${URL_PATH}${REF}" | tar
cp -r ./tendermint-spec-"$REF"/proto/tendermint/* ./proto/tendermint
cp -r ./tendermint-spec-"$REF"/third_party/** ./third_party
MODNAME=$(go list -m)
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
@@ -38,21 +38,5 @@ echo "proto files have been compiled"
echo "removing copied files"
rm -rf ./proto/tendermint/abci
rm -rf ./proto/tendermint/blocksync/types.proto
rm -rf ./proto/tendermint/consensus/types.proto
rm -rf ./proto/tendermint/libs/bits/types.proto
rm -rf ./proto/tendermint/mempool/types.proto
rm -rf ./proto/tendermint/p2p/types.proto
rm -rf ./proto/tendermint/p2p/conn.proto
rm -rf ./proto/tendermint/p2p/pex.proto
rm -rf ./proto/tendermint/statesync/types.proto
rm -rf ./proto/tendermint/types/block.proto
rm -rf ./proto/tendermint/types/evidence.proto
rm -rf ./proto/tendermint/types/params.proto
rm -rf ./proto/tendermint/types/types.proto
rm -rf ./proto/tendermint/types/validator.proto
rm -rf ./proto/tendermint/version/types.proto
rm -rf ./thirdparty/proto/gogoproto/gogo.proto
find ./tendermint-spec-"$REF"/proto/tendermint/ -name *.proto | sed "s/\.\/tendermint-spec-$REF\/\(.*\)/\1/g" | xargs -I {} rm {}
rm -rf ./tendermint-spec-"$REF"

View File

@@ -5,6 +5,8 @@ set -eo pipefail
# This option specifies what the package will be named when imported by other packages.
# This option is not directly included in the proto files to allow the files to more easily
# be hosted in github.com/tendermint/spec and shared between other repos.
# If the option is already specified in the file, it will be replaced using the
# arguments passed to this script.
FNAME=$1
MODNAME=$(echo $2| sed 's/\//\\\//g')
@@ -16,4 +18,6 @@ fi
if ! `grep -q 'option\s\+go_package\s\+=\s\+.*;' $FNAME`; then
sed -i "s/\(package tendermint.*\)/\1\n\noption go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME
else
sed -i "s/option\s\+go_package\s\+=\s\+.*;/option go_package = \"$MODNAME\/$PACKAGE\";/g" $FNAME
fi