Skip to content

Commit 543d0ee

Browse files
committed
Update protobuf generation infrastructure
1 parent 8d271ab commit 543d0ee

File tree

11 files changed

+163
-73
lines changed

11 files changed

+163
-73
lines changed

Makefile

+15-30
Original file line numberDiff line numberDiff line change
@@ -565,45 +565,30 @@ aesm-image:
565565
docker build -f deployment/dockerfiles/aesm.Dockerfile -t enigmampc/aesm .
566566

567567
###############################################################################
568-
### Swagger & Protobuf ###
568+
### Protobuf ###
569569
###############################################################################
570570

571-
.PHONY: update-swagger-openapi-docs statik statik-install proto-swagger-openapi-gen
571+
protoVer=0.14.0
572+
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
573+
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
572574

573-
statik-install:
574-
@echo "Installing statik..."
575-
@go install github.com/rakyll/[email protected]
576-
577-
statik:
578-
statik -src=client/docs/static/ -dest=client/docs -f -m
579-
580-
proto-swagger-openapi-gen:
581-
cp go.mod /tmp/go.mod.bak
582-
cp go.sum /tmp/go.sum.bak
583-
@./scripts/protoc-swagger-openapi-gen.sh
584-
cp /tmp/go.mod.bak go.mod
585-
cp /tmp/go.sum.bak go.sum
586-
587-
# Example `CHAIN_VERSION=v1.4.0 make update-swagger-openapi-docs`
588-
update-swagger-openapi-docs: statik-install proto-swagger-openapi-gen statik
589-
590-
protoVer=v0.2
591-
592-
proto-all: proto-lint proto-gen proto-swagger-openapi-gen
575+
proto-all: proto-format proto-gen proto-swagger-gen
593576

594577
proto-gen:
595-
cp go.mod /tmp/go.mod.bak
596-
cp go.sum /tmp/go.sum.bak
597578
@echo "Generating Protobuf files"
598-
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen:$(protoVer) sh ./scripts/protocgen.sh
599-
cp /tmp/go.mod.bak go.mod
600-
cp /tmp/go.sum.bak go.sum
601-
go mod tidy
579+
@$(protoImage) sh ./scripts/protocgen.sh
580+
581+
proto-swagger-gen:
582+
@echo "Generating Protobuf Swagger"
583+
@$(protoImage) sh ./scripts/protoc-swagger-gen.sh
584+
585+
proto-format:
586+
@$(protoImage) find ./proto -name "*.proto" -exec clang-format -i {} \;
602587

603588
proto-lint:
604-
@$(DOCKER_BUF) lint --error-format=json
589+
@$(protoImage) buf lint --error-format=json
605590

606-
.PHONY: proto-all proto-gen proto-format proto-lint proto-check-breaking
591+
.PHONY: proto-all proto-gen proto-swagger-gen proto-format proto-lint
607592

608593
.PHONY: check-hw
609594
check-hw: build-linux

buf.work.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version: v1
2+
directories:
3+
- proto

go.mod

+3-5
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,22 @@ go 1.21
55
replace (
66
github.com/cometbft/cometbft => github.com/scrtlabs/tendermint v0.38.2
77
github.com/cosmos/cosmos-sdk => github.com/scrtlabs/cosmos-sdk v0.46.0-beta2.0.20240319223406-51e8978ed8d6
8-
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
98
)
109

1110
require (
1211
github.com/cometbft/cometbft v0.38.5
1312
github.com/cosmos/cosmos-sdk v0.50.4
1413
github.com/cosmos/go-bip39 v1.0.0
14+
github.com/cosmos/gogoproto v1.4.11
1515
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.1
1616
github.com/cosmos/ibc-go/v8 v8.1.0
17-
github.com/gogo/protobuf v1.3.3
1817
github.com/golang/protobuf v1.5.3
1918
github.com/google/gofuzz v1.2.0
2019
github.com/gorilla/mux v1.8.1
2120
github.com/grpc-ecosystem/grpc-gateway v1.16.0
2221
github.com/miscreant/miscreant.go v0.0.0-20200214223636-26d376326b75
2322
github.com/pkg/errors v0.9.1
2423
github.com/rakyll/statik v0.1.7
25-
github.com/regen-network/cosmos-proto v0.3.1
2624
github.com/rs/zerolog v1.32.0 // indirect
2725
github.com/spf13/cast v1.6.0
2826
github.com/spf13/cobra v1.8.0
@@ -55,8 +53,9 @@ require (
5553
cosmossdk.io/x/tx v0.13.0
5654
github.com/cometbft/cometbft-db v0.9.1
5755
github.com/cosmos/cosmos-db v1.0.0
58-
github.com/cosmos/gogoproto v1.4.11
56+
github.com/cosmos/cosmos-proto v1.0.0-beta.4
5957
github.com/cosmos/rosetta v0.50.4
58+
github.com/gogo/protobuf v1.3.2
6059
)
6160

6261
require (
@@ -93,7 +92,6 @@ require (
9392
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
9493
github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect
9594
github.com/cosmos/btcutil v1.0.5 // indirect
96-
github.com/cosmos/cosmos-proto v1.0.0-beta.4 // indirect
9795
github.com/cosmos/gogogateway v1.2.0 // indirect
9896
github.com/cosmos/iavl v1.0.1 // indirect
9997
github.com/cosmos/ics23/go v0.10.0 // indirect

go.sum

+10-5
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,12 @@ github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFG
496496
github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c=
497497
github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0=
498498
github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4=
499+
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
500+
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
501+
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
502+
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
503+
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
504+
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
499505
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
500506
github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68=
501507
github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w=
@@ -724,6 +730,8 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X
724730
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
725731
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
726732
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
733+
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
734+
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
727735
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
728736
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
729737
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
@@ -918,10 +926,6 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung
918926
github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
919927
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
920928
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
921-
github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg=
922-
github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM=
923-
github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4=
924-
github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI=
925929
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
926930
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
927931
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -1351,8 +1355,10 @@ golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxb
13511355
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
13521356
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
13531357
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
1358+
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
13541359
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
13551360
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
1361+
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
13561362
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
13571363
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
13581364
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
@@ -1508,7 +1514,6 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG
15081514
google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
15091515
google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
15101516
google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
1511-
google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
15121517
google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
15131518
google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
15141519
google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=

proto/buf.gen.gogo.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: v1beta1
2+
plugins:
3+
- name: gocosmos
4+
out: ..
5+
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mcosmos/orm/v1/orm.proto=cosmossdk.io/orm
6+
- name: grpc-gateway
7+
out: ..
8+
opt: logtostderr=true,allow_colon_final_segments=true

proto/buf.gen.swagger.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: v1
2+
plugins:
3+
- name: swagger
4+
out: ../tmp-swagger-gen
5+
opt: logtostderr=true,fqn_for_swagger_name=true,simple_operation_ids=true

proto/buf.lock

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by buf. DO NOT EDIT.
2+
version: v1
3+
deps:
4+
- remote: buf.build
5+
owner: cosmos
6+
repository: cosmos-proto
7+
commit: 1935555c206d4afb9e94615dfd0fad31
8+
digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377
9+
- remote: buf.build
10+
owner: cosmos
11+
repository: cosmos-sdk
12+
commit: 05419252bcc241ea8023acf1ed4cadc5
13+
digest: shake256:1e54a48c19a8b59d35e0a7efa76402939f515f2d8005df099856f24c37c20a52800308f025abb8cffcd014d437b49707388aaca4865d9d063d8f25d5d4eb77d5
14+
- remote: buf.build
15+
owner: cosmos
16+
repository: gogo-proto
17+
commit: 88ef6483f90f478fb938c37dde52ece3
18+
digest: shake256:89c45df2aa11e0cff97b0d695436713db3d993d76792e9f8dc1ae90e6ab9a9bec55503d48ceedd6b86069ab07d3041b32001b2bfe0227fa725dd515ff381e5ba
19+
- remote: buf.build
20+
owner: googleapis
21+
repository: googleapis
22+
commit: ee48893a270147348e3edc6c1a03de0e
23+
digest: shake256:a35b0576a2b55dad72747e786af05c03539c2b96be236c9de39fe10d551931ac252eb68445c0cef6bbd27fa20e8c26eee5b8a9fe9c2fde6f63a03e18f8cf980d
24+
- remote: buf.build
25+
owner: protocolbuffers
26+
repository: wellknowntypes
27+
commit: 657250e6a39648cbb169d079a60bd9ba
28+
digest: shake256:00de25001b8dd2e29d85fc4bcc3ede7aed886d76d67f5e0f7a9b320b90f871d3eb73507d50818d823a0512f3f8db77a11c043685528403e31ff3fef18323a9fb
29+
- remote: buf.build
30+
owner: tendermint
31+
repository: tendermint
32+
commit: 33ed361a90514289beabf3189e1d7665
33+
digest: shake256:038267e06294714fd883610626554b04a127b576b4e253befb4206cb72d5d3c1eeccacd4b9ec8e3fb891f7c14e1cb0f770c077d2989638995b0a61c85afedb1d

proto/buf.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This module represents buf.build/cosmos/cosmos-sdk
2+
version: v1
3+
deps:
4+
- buf.build/cosmos/cosmos-proto
5+
- buf.build/cosmos/cosmos-sdk
6+
- buf.build/cosmos/gogo-proto
7+
- buf.build/googleapis/googleapis
8+
breaking:
9+
use:
10+
- FILE
11+
lint:
12+
use:
13+
- DEFAULT
14+
- COMMENTS
15+
- FILE_LOWER_SNAKE_CASE
16+
except:
17+
- UNARY_RPC
18+
- COMMENT_FIELD
19+
- SERVICE_SUFFIX
20+
- PACKAGE_VERSION_SUFFIX
21+
- RPC_REQUEST_STANDARD_NAME
22+
ignore:
23+
- tendermint

proto/secret/registration/v1beta1/remote_attestation/types.proto proto/secret/registration/remote_attestation/v1beta1/types.proto

+10-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,18 @@ option (gogoproto.goproto_getters_all) = false;
88
option (gogoproto.equal_all) = true;
99

1010
message QuoteReport {
11-
string id = 1 [(gogoproto.customname) = "ID"];
11+
string id = 1 [ (gogoproto.customname) = "ID" ];
1212
string timestamp = 2;
1313
uint64 version = 3;
14-
string isv_enclave_quote_status = 4 [(gogoproto.jsontag) = "isvEnclaveQuoteStatus"];
15-
string platform_info_blob = 5 [(gogoproto.jsontag) = "platformInfoBlob"];
16-
string isv_enclave_quote_body = 6 [(gogoproto.jsontag) = "isvEnclaveQuoteBody"];
17-
repeated string advisory_ids = 7 [(gogoproto.customname) = "AdvisoryIDs", (gogoproto.jsontag) = "advisoryIDs"];
14+
string isv_enclave_quote_status = 4
15+
[ (gogoproto.jsontag) = "isvEnclaveQuoteStatus" ];
16+
string platform_info_blob = 5 [ (gogoproto.jsontag) = "platformInfoBlob" ];
17+
string isv_enclave_quote_body = 6
18+
[ (gogoproto.jsontag) = "isvEnclaveQuoteBody" ];
19+
repeated string advisory_ids = 7 [
20+
(gogoproto.customname) = "AdvisoryIDs",
21+
(gogoproto.jsontag) = "advisoryIDs"
22+
];
1823
}
1924

2025
message QuoteReportBody {

scripts/protoc-swagger-gen.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
set -eo pipefail
4+
5+
mkdir -p ./tmp-swagger-gen
6+
cd proto
7+
proto_dirs=$(find ./secret -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
8+
for dir in $proto_dirs; do
9+
# generate swagger files (filter query files)
10+
query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \))
11+
if [[ ! -z "$query_file" ]]; then
12+
buf generate --template buf.gen.swagger.yaml $query_file
13+
fi
14+
done
15+
16+
cd ..
17+
# combine swagger files
18+
# uses nodejs package `swagger-combine`.
19+
# all the individual swagger files need to be configured in `config.json` for merging
20+
swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true
21+
22+
# clean swagger files
23+
rm -rf ./tmp-swagger-gen

scripts/protocgen.sh

+30-28
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
#!/usr/bin/env bash
22

3-
set -eo pipefail
3+
# How to run manually:
4+
# docker build --pull --rm -f "contrib/devtools/Dockerfile" -t cosmossdk-proto:latest "contrib/devtools"
5+
# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh
46

5-
protoc_gen_gocosmos() {
6-
if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
7-
echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder."
8-
return 1
9-
fi
7+
echo "Formatting protobuf files"
8+
# find ./ -name "*.proto" -exec clang-format -i {} \;
109

11-
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest
12-
}
10+
set -e
1311

14-
protoc_gen_gocosmos
15-
16-
proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
12+
echo "Generating gogo proto code"
13+
cd proto
14+
proto_dirs=$(find ./secret -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
1715
for dir in $proto_dirs; do
18-
buf protoc \
19-
-I "proto" \
20-
-I "third_party/proto" \
21-
--gocosmos_out=plugins=interfacetype+grpc,\
22-
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
23-
--grpc-gateway_out=logtostderr=true:. \
24-
$(find "${dir}" -maxdepth 1 -name '*.proto')
25-
16+
for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
17+
# this regex checks if a proto file has its go_package set to cosmossdk.io/api/...
18+
# gogo proto files SHOULD ONLY be generated if this is false
19+
# we don't want gogo proto to run for proto files which are natively built for google.golang.org/protobuf
20+
# if grep -q "option go_package" "$file" && grep -H -o -c 'option go_package.*cosmossdk.io/api' "$file" | grep -q ':0$'; then
21+
buf generate --template buf.gen.gogo.yaml $file
22+
# fi
23+
done
2624
done
2725

28-
# command to generate docs using protoc-gen-doc
29-
#buf protoc \
30-
#-I "proto" \
31-
#-I "third_party/proto" \
32-
#--doc_out=./docs/proto \
33-
#--doc_opt=./docs/proto/protodoc-markdown.tmpl,proto-docs.md \
34-
#$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto') \
35-
#$(find "$(pwd)/third_party/proto/cosmos" -maxdepth 4 -name '*.proto') \
36-
#$(find "$(pwd)/third_party/proto/ibc" -maxdepth 4 -name '*.proto')
26+
cd ..
27+
28+
# generate tests proto code
29+
# (cd testutil/testdata; buf generate)
30+
# (cd baseapp/testutil; buf generate)
31+
# (cd tests/integration/tx/internal; make codegen)
3732

3833
# move proto files to the right places
3934
cp -r github.com/scrtlabs/SecretNetwork/* ./
4035
rm -rf github.com
36+
# cp -r github.com/cosmos/cosmos-sdk/* ./
37+
# cp -r cosmossdk.io/** ./
38+
# rm -rf github.com cosmossdk.io
39+
40+
go mod tidy
41+
42+
# ./scripts/protocgen-pulsar.sh

0 commit comments

Comments
 (0)