Skip to content

Commit

Permalink
fix: install protoc-gen-cosmos into cache dir (#892)
Browse files Browse the repository at this point in the history
fixes #891

Signed-off-by: Artur Troian <troian.ap@gmail.com>
  • Loading branch information
troian committed Nov 5, 2020
1 parent 8f77a64 commit c0becaf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 15 deletions.
25 changes: 14 additions & 11 deletions Makefile
Expand Up @@ -16,20 +16,23 @@ CACHE_BIN := $(CACHE)/bin
CACHE_INCLUDE := $(CACHE)/include
CACHE_VERSIONS := $(CACHE)/versions

BUF_VERSION ?= 0.25.0
PROTOC_VERSION ?= 3.13.0
GRPC_GATEWAY_VERSION ?= 1.14.7
GOLANGCI_LINT_VERSION ?= v1.31.0
GOLANG_VERSION ?= 1.15.2
GOLANG_CROSS_VERSION := v$(GOLANG_VERSION)
BUF_VERSION ?= 0.25.0
PROTOC_VERSION ?= 3.13.0
PROTOC_GEN_COSMOS_VERSION ?= master
GRPC_GATEWAY_VERSION ?= 1.14.7
GOLANGCI_LINT_VERSION ?= v1.31.0
GOLANG_VERSION ?= 1.15.2
GOLANG_CROSS_VERSION := v$(GOLANG_VERSION)

# <TOOL>_VERSION_FILE points to the marker file for the installed version.
# If <TOOL>_VERSION_FILE is changed, the binary will be re-downloaded.
PROTOC_VERSION_FILE = $(CACHE_VERSIONS)/protoc/$(PROTOC_VERSION)
GRPC_GATEWAY_VERSION_FILE = $(CACHE_VERSIONS)/protoc-gen-grpc-gateway/$(GRPC_GATEWAY_VERSION)
MODVENDOR = $(CACHE_BIN)/modvendor
PROTOC := $(CACHE_BIN)/protoc
GRPC_GATEWAY := $(CACHE_BIN)/protoc-gen-grpc-gateway
PROTOC_VERSION_FILE = $(CACHE_VERSIONS)/protoc/$(PROTOC_VERSION)
GRPC_GATEWAY_VERSION_FILE = $(CACHE_VERSIONS)/protoc-gen-grpc-gateway/$(GRPC_GATEWAY_VERSION)
PROTOC_GEN_COSMOS_VERSION_FILE = $(CACHE_VERSIONS)/protoc-gen-cosmos/$(PROTOC_GEN_COSMOS_VERSION)
MODVENDOR = $(CACHE_BIN)/modvendor
PROTOC := $(CACHE_BIN)/protoc
PROTOC_GEN_COSMOS := $(CACHE_BIN)/protoc-gen-cosmos
GRPC_GATEWAY := $(CACHE_BIN)/protoc-gen-grpc-gateway

DOCKER_RUN := docker run --rm -v $(shell pwd):/workspace -w /workspace
DOCKER_BUF := $(DOCKER_RUN) bufbuild/buf:$(BUF_VERSION)
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Expand Up @@ -141,8 +141,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/cosmos-sdk v0.40.0-rc0 h1:GY+jzuVILZ7wlx5Zic2W0rWlo47fZgN048xV458sUAo=
github.com/cosmos/cosmos-sdk v0.40.0-rc0/go.mod h1:YZcO00Tq/qqj4ncsfn+PobyTelsot7wEMGPpxEbEAT0=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/iavl v0.15.0-rc3 h1:rSm60IFfDCD9qDfvXKEmaJhcv0rB5uCbVlBDKsynxqw=
Expand Down
2 changes: 1 addition & 1 deletion make/codegen.mk
Expand Up @@ -19,7 +19,7 @@ kubetypes: deps-vendor
akash.network:v1

.PHONY: proto-gen
proto-gen: $(PROTOC) $(GRPC_GATEWAY) modvendor proto-format
proto-gen: $(PROTOC) $(GRPC_GATEWAY) $(PROTOC_GEN_COSMOS) modvendor proto-format
./script/protocgen.sh

.PHONY: proto-swagger-gen
Expand Down
9 changes: 9 additions & 0 deletions make/setup-cache.mk
Expand Up @@ -18,6 +18,15 @@ $(PROTOC_VERSION_FILE): $(CACHE)
touch $@
$(PROTOC): $(PROTOC_VERSION_FILE)

$(PROTOC_GEN_COSMOS_VERSION_FILE): $(CACHE)
@echo "installing protoc-gen-cosmos..."
rm -f $(PROTOC_GEN_COSMOS)
GOBIN=$(CACHE_BIN) $(GO) install github.com/regen-network/cosmos-proto/protoc-gen-gocosmos
rm -rf "$(dir $@)"
mkdir -p "$(dir $@)"
touch $@
$(PROTOC_GEN_COSMOS): $(PROTOC_GEN_COSMOS_VERSION_FILE)

$(GRPC_GATEWAY_VERSION_FILE): $(CACHE)
@echo "Installing protoc-gen-grpc-gateway..."
rm -f $(GRPC_GATEWAY)
Expand Down
1 change: 0 additions & 1 deletion script/protocgen.sh
Expand Up @@ -23,7 +23,6 @@ Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
-I "vendor/github.com/cosmos/cosmos-sdk/third_party/proto" \
--grpc-gateway_out=logtostderr=true:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')

done

# move proto files to the right places
Expand Down

0 comments on commit c0becaf

Please sign in to comment.