cosmos-sdk/scripts/protocgen.sh

44 lines
1.4 KiB
Bash
Raw Permalink Normal View History

#!/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 get 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,allow_colon_final_segments=true:. \
Add Grpc gateway annotations (#6918) * grpc for bank module * edit module.go * added annotations for x/auth query proto * generated gw file * added grpc gateway for x/staking query proto * added annotations for evidence * added annotations for gov query proto * added annotations * added annotations for slashing module * updated annotations * added annotations for staking module * added annotations for upgrade query * annotations added for x/ibc/channel query proto * added annotations for ibc/connection query proto * updated annotations * updated annotations * annotation changes * ommitted ibc module * updated go.mod * fixed lint issue * review changes * review changes * review changes * review changes * go sum changes * updated annotations * annotation changes * Fix proto lint issues * review changes * review changes * review changes * discussion changes * review changes * grpc for bank module * edit module.go * added annotations for x/auth query proto * generated gw file * added grpc gateway for x/staking query proto * added annotations for evidence * added annotations for gov query proto * added annotations * added annotations for slashing module * updated annotations * added annotations for staking module * added annotations for upgrade query * annotations added for x/ibc/channel query proto * added annotations for ibc/connection query proto * updated annotations * updated annotations * annotation changes * ommitted ibc module * updated go.mod * fixed lint issue * review changes * review changes * review changes * review changes * go sum changes * updated annotations * annotation changes * Fix proto lint issues * review changes * review changes * review changes * discussion changes * review changes * fixed conflicts * review changes * updated gw files * lint * lint * lint * added missing annotations * review changes * review changes * review changes * review changes Co-authored-by: SaReN <sahithnarahari@gmail.com> Co-authored-by: Anil Kumar Kammari <anil@vitwit.com>
2020-08-14 03:05:35 -07:00
$(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/core \
--doc_opt=./docs/protodoc-markdown.tmpl,proto-docs.md \
$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')
go mod tidy
2020-07-01 08:26:29 -07:00
# generate codec/testdata proto code
buf protoc -I "proto" -I "third_party/proto" -I "testutil/testdata" --gocosmos_out=plugins=interfacetype+grpc,\
Add ADR 031 BaseApp and codec infrastructure (#7519) * Refactor RegisterQueryServices -> RegisterServices * Cleaner proto files * Fix tests * Add MsgServer * Fix lint * Remove MsgServer from configurator for now * Remove useless file * Fix build * typo * Add router * Fix test * WIP * Add router * Remove test helper * Add beginning of test * Move test to simapp? * ServiceMsg implement sdk.Msg * Add handler by MsgServiceRouter * Correct signature * Add full test * use TxEncoder * Update baseapp/msg_service_router.go Co-authored-by: Aaron Craelius <aaron@regen.network> * Push changes * WIP on ServiceMsg unpacking * Make TestMsgService test pass * Fix tests * Tidying up * Tidying up * Tidying up * Add JSON test * Add comments * Tidying * Lint * Register MsgRequest interface * Rename * Fix tests * RegisterCustomTypeURL * Add changelog entries * Put in features * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Update baseapp/msg_service_router.go Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> * Address review comments * Address nit * Fix lint * Update codec/types/interface_registry.go Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com> * godoc Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com> Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Aleksandr Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Marie Gauthier <marie.gauthier63@gmail.com>
2020-10-15 06:07:59 -07:00
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. ./testutil/testdata/*.proto
2020-07-01 08:26:29 -07:00
# move proto files to the right places
cp -r github.com/cosmos/cosmos-sdk/* ./
rm -rf github.com