abci++: Remove intermediate protos (#8414)

* Sync protos with their intermediates

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Remove intermediate protos and their supporting scripts

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* make proto-gen

Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
Thane Thomson
2022-04-26 08:02:17 -04:00
committed by GitHub
parent e36052c80e
commit dcfbd9bc3d
10 changed files with 225 additions and 1012 deletions

View File

@@ -1,29 +0,0 @@
#!/usr/bin/env bash
# This file was added during development of ABCI++. This file is a script to allow
# the intermediate proto files to be built while active development proceeds
# on ABCI++.
# This file should be removed when work on ABCI++ is complete.
# For more information, see https://github.com/tendermint/tendermint/issues/8066.
set -euo pipefail
cp ./proto/tendermint/abci/types.proto.intermediate ./proto/tendermint/abci/types.proto
cp ./proto/tendermint/types/types.proto.intermediate ./proto/tendermint/types/types.proto
MODNAME="$(go list -m)"
find ./proto/tendermint -name '*.proto' -not -path "./proto/tendermint/abci/types.proto" \
-exec ./scripts/protopackage.sh {} "$MODNAME" ';'
./scripts/protopackage.sh ./proto/tendermint/abci/types.proto $MODNAME "abci/types"
make proto-gen
echo "proto files have been compiled"
echo "checking out copied files"
find proto/tendermint/ -name '*.proto' -not -path "*.intermediate"\
| xargs -I {} git checkout {}
find proto/tendermint/ -name '*.pb.go' \
| xargs -I {} git checkout {}

View File

@@ -1,23 +0,0 @@
#!/bin/bash
set -eo pipefail
# This script appends the "option go_package" proto option to the file located at $FNAME.
# 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:?missing required .proto filename}"
MODNAME=$(echo $2| sed 's/\//\\\//g')
PACKAGE="$(dirname $FNAME | sed 's/^\.\/\(.*\)/\1/g' | sed 's/\//\\\//g')"
if [[ ! -z "$3" ]]; then
PACKAGE="$(echo $3 | sed 's/\//\\\//g')"
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