Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependencies for protobuf and remove third_party forlder #1030

Merged
merged 3 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ format: format-tools
###############################################################################
### Protobuf ###
###############################################################################
PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.2
PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen:v0.7
PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae

proto-all: proto-format proto-lint proto-gen format
Expand Down
1 change: 0 additions & 1 deletion buf.work.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@
version: v1
directories:
- proto
- third_party/proto
5 changes: 5 additions & 0 deletions proto/buf.gen.doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
version: v1
plugins:
- name: doc
out: ../docs/proto
opt: ../docs/proto/protodoc-markdown.tmpl,proto-docs.md
8 changes: 8 additions & 0 deletions proto/buf.gen.gogo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: v1
plugins:
- name: gocosmos
out: ..
opt: plugins=grpc,Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types
- name: grpc-gateway
out: ..
opt: logtostderr=true,allow_colon_final_segments=true
19 changes: 19 additions & 0 deletions proto/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: cosmos
repository: cosmos-proto
commit: 1935555c206d4afb9e94615dfd0fad31
- remote: buf.build
owner: cosmos
repository: cosmos-sdk
commit: 8cb30a2c4de74dc9bd8d260b1e75e176
- remote: buf.build
owner: cosmos
repository: gogo-proto
commit: 6652e3443c3b4504bb3bf82e73a7e409
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 8d7204855ec14631a499bd7393ce1970
4 changes: 4 additions & 0 deletions proto/buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# the previous configuration.
version: v1
name: buf.build/cosmwasm/wasmd
deps:
- buf.build/cosmos/cosmos-proto
- buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 #v0.46.x
Copy link
Contributor

@alpe alpe Oct 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌 to use this as a temporary version

- buf.build/cosmos/gogo-proto
breaking:
use:
- FILE
Expand Down
41 changes: 22 additions & 19 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -eo pipefail

protoc_gen_gocosmos() {
protoc_install_gocosmos() {
if ! grep "github.com/gogo/protobuf => github.com/regen-network/protobuf" go.mod &>/dev/null ; then
echo -e "\tPlease run this command from somewhere inside the cosmos-sdk folder."
return 1
Expand All @@ -11,27 +11,30 @@ protoc_gen_gocosmos() {
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null
}

protoc_gen_gocosmos
protoc_install_proto_gen_doc() {
echo "Installing protobuf protoc-gen-doc plugin"
(go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest 2> /dev/null)
}

proto_dirs=$(find ./proto -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
buf protoc \
-I "proto" \
-I "third_party/proto" \
--gocosmos_out=plugins=interfacetype+grpc,\
Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types:. \
--grpc-gateway_out=logtostderr=true:. \
$(find "${dir}" -maxdepth 1 -name '*.proto')
protoc_install_gocosmos

echo "Generating gogo proto code"
cd proto
proto_dirs=$(find ./cosmwasm -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
for file in $(find "${dir}" -maxdepth 1 -name '*.proto'); do
if grep "option go_package" $file &> /dev/null ; then
buf generate --template buf.gen.gogo.yml $file
fi
done
done
#
## command to generate docs using protoc-gen-doc
buf protoc \
-I "proto" \
-I "third_party/proto" \
--doc_out=./docs/proto \
--doc_opt=./docs/proto/protodoc-markdown.tmpl,proto-docs.md \
$(find "$(pwd)/proto" -maxdepth 5 -name '*.proto')

protoc_install_proto_gen_doc

echo "Generating proto docs"
buf generate --template buf.gen.doc.yml

cd ..

# move proto files to the right places
cp -r github.com/CosmWasm/wasmd/* ./
Expand Down
40 changes: 0 additions & 40 deletions third_party/proto/buf.yaml

This file was deleted.

1 change: 0 additions & 1 deletion third_party/proto/confio/README.md

This file was deleted.

234 changes: 0 additions & 234 deletions third_party/proto/confio/proofs.proto

This file was deleted.

Loading