Add dependencies for protobuf and remove third_party forlder (#1030)
* Add dependencies for proto files and remove third_party forlder * Pin cosmos-sdk dependency to v0.46.x * Run "make proto-all" and generate new types files.
This commit is contained in:
@@ -2,37 +2,31 @@
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
protoc_gen_gocosmos() {
|
||||
if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
|
||||
echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder."
|
||||
return 1
|
||||
fi
|
||||
|
||||
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null
|
||||
protoc_install_proto_gen_doc() {
|
||||
echo "Installing protobuf protoc-gen-doc plugin"
|
||||
(go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest 2> /dev/null)
|
||||
}
|
||||
|
||||
protoc_gen_gocosmos
|
||||
|
||||
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
|
||||
echo "Generating gogo proto code"
|
||||
cd proto
|
||||
proto_dirs=$(find ./cosmwasm -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" \
|
||||
--gocosmos_out=plugins=interfacetype+grpc,\
|
||||
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
|
||||
--grpc-gateway_out=logtostderr=true:. \
|
||||
$(find "${dir}" -maxdepth 1 -name '*.proto')
|
||||
|
||||
for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
|
||||
if grep "option go_package" $file &> /dev/null ; then
|
||||
buf generate --template buf.gen.gogo.yml $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
#
|
||||
## command to generate docs using protoc-gen-doc
|
||||
buf protoc \
|
||||
-I "proto" \
|
||||
-I "third_party/proto" \
|
||||
--doc_out=./docs/proto \
|
||||
--doc_opt=./docs/proto/protodoc-markdown.tmpl,proto-docs.md \
|
||||
$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')
|
||||
|
||||
protoc_install_proto_gen_doc
|
||||
|
||||
echo "Generating proto docs"
|
||||
buf generate --template buf.gen.doc.yml
|
||||
|
||||
cd ..
|
||||
|
||||
# move proto files to the right places
|
||||
cp -r github.com/CosmWasm/wasmd/* ./
|
||||
rm -rf github.com
|
||||
|
||||
go mod tidy
|
||||
|
||||
Reference in New Issue
Block a user