Skip to content

Commit

Permalink
ci: Update protobuf generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
hochiw committed Feb 16, 2022
1 parent 76a60d0 commit 3e5a0fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ release:
proto-all: proto-format proto-lint gen-proto

gen-proto: x/
./gen_proto.sh
./scripts//gen_proto.sh

proto-format:
@echo "Formatting Protobuf files"
Expand Down
12 changes: 8 additions & 4 deletions gen_proto.sh → scripts/gen_proto.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
#!/bin/bash

# get protoc executions
go install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos
export PATH="$PATH:$(go env GOPATH)/bin"

pushd $(dirname $0) > /dev/null 2>&1

SWAGGER_DIR="swagger-gen"
COSMOS_SDK_VERSION=$(grep "github.com/cosmos/cosmos-sdk" go.mod | head -n 1 | sed 's/.*github.com\/cosmos\/cosmos-sdk \(.*\)/\1/g')
COSMOS_SDK_DIR=$(go list -f '{{ .Dir }}' -m github.com/cosmos/cosmos-sdk)

pushd x > /dev/null 2>&1
MODULES=(*)
Expand All @@ -13,8 +17,8 @@ mkdir -p ${SWAGGER_DIR}

for module in "${MODULES[@]}"; do
protoc \
-I "$GOPATH/pkg/mod/github.com/cosmos/cosmos-sdk@${COSMOS_SDK_VERSION}/proto" \
-I "$GOPATH/pkg/mod/github.com/cosmos/cosmos-sdk@${COSMOS_SDK_VERSION}/third_party/proto" \
-I "$COSMOS_SDK_DIR/proto" \
-I "$COSMOS_SDK_DIR/third_party/proto" \
--gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
--grpc-gateway_out=logtostderr=true:. \
--proto_path proto \
Expand All @@ -25,4 +29,4 @@ for module in "${MODULES[@]}"; do
mv github.com/likecoin/likechain/x/${module}/types/* x/${module}/types/
done

popd > /dev/null 2>&1
popd > /dev/null 2>&1

0 comments on commit 3e5a0fa

Please sign in to comment.