Files
wasmd/scripts/protocgen.sh
Jacob Gadikian 61bda97df2 close 815: upgrade to go 1.18 (#866)
* close 815: upgrade to go 1.18

* Update CHANGELOG.md

* updater ci and docker to go 1.18

* update image per: https://discuss.circleci.com/t/legacy-convenience-image-deprecation/41034

* Update config.yml

* go get -> go install, except dockerfile for protos
2022-08-24 11:52:55 +02:00

39 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
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 install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null
}
protoc_gen_gocosmos
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" \
--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')
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')
# move proto files to the right places
cp -r github.com/CosmWasm/wasmd/* ./
rm -rf github.com