Skip to content

Commit

Permalink
build(cosmos): avoid needless go
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Apr 9, 2024
1 parent 451746f commit 2ab96b0
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions golang/cosmos/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ proto-lint: proto-tools
proto-check-breaking: proto-tools
${BIN}/buf breaking --against $(PR_TARGET_REPO)#branch=$(PR_TARGET_BRANCH),subdir=golang/cosmos

GOGO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/gogo/protobuf)
# GOOGLE_API_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/googleapis/googleapis)/google/api
IBC_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v6)/proto/ibc/core
COSMOS_PROTO_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-proto)/proto/cosmos_proto
COSMOS_SDK_PROTO_URL := file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-sdk)/proto/cosmos
GOGO_PROTO_URL = file://$(shell go list -m -f '{{ .Dir }}' github.com/gogo/protobuf)
# GOOGLE_API_URL = file://$(shell go list -m -f '{{ .Dir }}' github.com/googleapis/googleapis)/google/api
IBC_PROTO_URL = file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/ibc-go/v6)/proto/ibc/core
COSMOS_PROTO_PROTO_URL = file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-proto)/proto/cosmos_proto
COSMOS_SDK_PROTO_URL = file://$(shell go list -m -f '{{ .Dir }}' github.com/cosmos/cosmos-sdk)/proto/cosmos

COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto
GOGO_PROTO_TYPES = third_party/proto/gogoproto
Expand All @@ -116,34 +116,37 @@ SDK_UPGRADE_TYPES = third_party/proto/cosmos/upgrade/v1beta1

proto-update-deps:
mkdir -p $(COSMOS_PROTO_TYPES)
curl -sSL $(COSMOS_PROTO_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto
url="$(COSMOS_PROTO_PROTO_URL)"; \
curl -sSL $$url/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto

mkdir -p $(GOGO_PROTO_TYPES)
curl -sSL $(GOGO_PROTO_URL)/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto
url="$(GOGO_PROTO_URL)"; \
curl -sSL $$url/gogoproto/gogo.proto > $(GOGO_PROTO_TYPES)/gogo.proto

# Downloading from a not-a-go-module is problematic. These files are artifacts for now.
# mkdir -p $(GOOGLE_API_TYPES)
# curl -sSL $(GOOGLE_API_URL)/annotations.proto > $(GOOGLE_API_TYPES)/annotations.proto
# curl -sSL $(GOOGLE_API_URL)/http.proto > $(GOOGLE_API_TYPES)/http.proto
# curl -sSL $(GOOGLE_API_URL)/httpbody.proto > $(GOOGLE_API_TYPES)/httpbody.proto
# url="$(GOOGLE_API_URL)"; \
# curl -sSL $$url/annotations.proto > $(GOOGLE_API_TYPES)/annotations.proto && \
# curl -sSL $$url/http.proto > $(GOOGLE_API_TYPES)/http.proto && \
# curl -sSL $$url/httpbody.proto > $(GOOGLE_API_TYPES)/httpbody.proto &&

mkdir -p $(GOOGLE_PROTO_TYPES)
curl -sSL $(GOGO_PROTO_URL)/protobuf/google/protobuf/any.proto > $(GOOGLE_PROTO_TYPES)/any.proto

mkdir -p $(IBC_CHANNEL_TYPES)
curl -sSL $(IBC_PROTO_URL)/channel/v1/channel.proto > $(IBC_CHANNEL_TYPES)/channel.proto

mkdir -p $(IBC_CLIENT_TYPES)
curl -sSL $(IBC_PROTO_URL)/client/v1/client.proto > $(IBC_CLIENT_TYPES)/client.proto

mkdir -p $(SDK_BASE_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/base/v1beta1/coin.proto > $(SDK_BASE_TYPES)/coin.proto

mkdir -p $(SDK_QUERY_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/base/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto

mkdir -p $(SDK_UPGRADE_TYPES)
curl -sSL $(COSMOS_SDK_PROTO_URL)/upgrade/v1beta1/upgrade.proto > $(SDK_UPGRADE_TYPES)/upgrade.proto
url="$(GOGO_PROTO_URL)"; \
curl -sSL $$url/protobuf/google/protobuf/any.proto > $(GOOGLE_PROTO_TYPES)/any.proto

url="$(IBC_PROTO_URL)"; \
mkdir -p $(IBC_CHANNEL_TYPES) && \
curl -sSL $$url/channel/v1/channel.proto > $(IBC_CHANNEL_TYPES)/channel.proto && \
mkdir -p $(IBC_CLIENT_TYPES) && \
curl -sSL $$url/client/v1/client.proto > $(IBC_CLIENT_TYPES)/client.proto

url="$(COSMOS_SDK_PROTO_URL)"; \
mkdir -p $(SDK_BASE_TYPES) && \
curl -sSL $$url/base/v1beta1/coin.proto > $(SDK_BASE_TYPES)/coin.proto && \
mkdir -p $(SDK_QUERY_TYPES) && \
curl -sSL $$url/base/query/v1beta1/pagination.proto > $(SDK_QUERY_TYPES)/pagination.proto && \
mkdir -p $(SDK_UPGRADE_TYPES) && \
curl -sSL $$url/upgrade/v1beta1/upgrade.proto > $(SDK_UPGRADE_TYPES)/upgrade.proto

UNAME_S ?= $(shell uname -s)
UNAME_M ?= $(shell uname -m)
Expand Down

0 comments on commit 2ab96b0

Please sign in to comment.