Skip to content

Commit

Permalink
🔨 Write Protobuf related file generation into Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
nnkken committed Jan 6, 2022
1 parent 5e89045 commit 193456a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 19 deletions.
17 changes: 16 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ LEDGER_ENABLED ?= true
DOCKER := $(shell which docker)
IMAGE_TAG = likecoin/likecoin-chain:$(VERSION)
BUILDDIR ?= $(CURDIR)/build
SWAGGER_OUT := swagger-gen
COSMOS_SDK_VERSION := $(shell grep "github.com/cosmos/cosmos-sdk" go.mod | head -n 1 | sed 's/.*github.com\/cosmos\/cosmos-sdk \(.*\)/\1/g')

export GO111MODULE = on

Expand Down Expand Up @@ -84,6 +86,19 @@ go.sum: go.mod
echo "--> Ensure dependencies have not been modified"
go mod verify

gen-proto: x/iscn
mkdir -p ${SWAGGER_OUT}
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" \
--gocosmos_out=plugins=interfacetype+grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
--grpc-gateway_out=logtostderr=true:. \
--proto_path proto \
./proto/iscn/* \
--swagger_out ${SWAGGER_OUT} \
--swagger_opt logtostderr=true --swagger_opt fqn_for_swagger_name=true --swagger_opt simple_operation_ids=true
mv github.com/likecoin/likechain/x/iscn/types/* x/iscn/types/

build-reproducible: go.sum
$(DOCKER) rm latest-build || true
$(DOCKER) run --volume=$(CURDIR):/sources:ro \
Expand Down Expand Up @@ -115,4 +130,4 @@ test:
clean:
rm -rf $(BUILDDIR)/ artifacts/

.PHONY: go-mod-cache build-reproducible build-docker build install test clean
.PHONY: go-mod-cache gen-proto build-reproducible build-docker build install test clean
18 changes: 0 additions & 18 deletions gen_proto.sh

This file was deleted.

0 comments on commit 193456a

Please sign in to comment.