makefile: buf setup backport v0.34 (#8863)

This commit is contained in:
Jasmina Malicevic
2022-06-24 19:58:25 +02:00
committed by GitHub
parent 4a1df4911d
commit b83cc0aeda
19 changed files with 318 additions and 94 deletions

19
scripts/proto-gen.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
#
# Update the generated code for protocol buffers in the Tendermint repository.
# This must be run from inside a Tendermint working directory.
#
set -euo pipefail
# Work from the root of the repository.
cd "$(git rev-parse --show-toplevel)"
# Run inside Docker to install the correct versions of the required tools
# without polluting the local system.
docker run --rm -i -v "$PWD":/w --workdir=/w golang:1.18-alpine sh <<"EOF"
apk add git make
go install github.com/bufbuild/buf/cmd/buf
go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest
make proto-gen
EOF

View File

@@ -1,22 +0,0 @@
#!/usr/bin/env bash
set -eo pipefail
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
buf protoc \
-I "proto" \
-I "third_party/proto" \
--gogofaster_out=\
Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,\
Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration,\
plugins=grpc,paths=source_relative:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')
done
cp -r ./tendermint/* ./proto/*
rm -rf tendermint
mv ./proto/tendermint/abci/types.pb.go ./abci/types
mv ./proto/tendermint/rpc/grpc/types.pb.go ./rpc/grpc