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

Restructure protobuf files #466

Merged
merged 2 commits into from
Mar 22, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
31 changes: 20 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ BINDIR ?= $(GOPATH)/bin
SIMAPP = ./app

# for dockerized protobuf tools
PROTO_CONTAINER := cosmwasm/prototools-docker:v0.1.0
DOCKER_BUF := docker run --rm -v $(shell pwd)/buf.yaml:/workspace/buf.yaml -v $(shell go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk):/workspace/cosmos_sdk_dir -v $(shell pwd):/workspace/wasmd --workdir /workspace $(PROTO_CONTAINER)
DOCKER := $(shell which docker)
BUF_IMAGE=bufbuild/buf@sha256:9dc5d6645f8f8a2d5aaafc8957fbbb5ea64eada98a84cb09654e8f49d6f73b3e
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
HTTPS_GIT := https://github.com/CosmWasm/wasmd.git

export GO111MODULE = on
Expand Down Expand Up @@ -201,21 +202,29 @@ format:
###############################################################################
### Protobuf ###
###############################################################################
PROTO_BUILDER_IMAGE=tendermintdev/sdk-proto-gen@sha256:372dce7be2f465123e26459973ca798fc489ff2c75aeecd814c0ca8ced24faca
alpe marked this conversation as resolved.
Show resolved Hide resolved
PROTO_FORMATTER_IMAGE=tendermintdev/docker-build-proto@sha256:aabcfe2fc19c31c0f198d4cd26393f5e5ca9502d7ea3feafbfe972448fee7cae

proto-all: proto-gen proto-lint proto-check-breaking
.PHONY: proto-all
proto-all: proto-format proto-lint proto-gen

proto-gen: proto-lint
@docker run --rm -v $(shell go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk):/workspace/cosmos_sdk_dir -v $(shell pwd):/workspace --workdir /workspace --env COSMOS_SDK_DIR=/workspace/cosmos_sdk_dir $(PROTO_CONTAINER) ./scripts/protocgen.sh
.PHONY: proto-gen
proto-gen:
@echo "Generating Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(PROTO_BUILDER_IMAGE) sh ./scripts/protocgen.sh

proto-format:
@echo "Formatting Protobuf files"
$(DOCKER) run --rm -v $(CURDIR):/workspace \
--workdir /workspace $(PROTO_FORMATTER_IMAGE) \
find ./ -not -path "./third_party/*" -name *.proto -exec clang-format -i {} \;

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh

proto-lint:
@$(DOCKER_BUF) buf check lint --error-format=json
.PHONY: proto-lint
@$(DOCKER_BUF) check lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) buf check breaking --against-input $(HTTPS_GIT)#branch=master
.PHONY: proto-check-breaking
@$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master

.PHONY: all build-linux install install-debug \
go-mod-cache draw-deps clean build format \
Expand Down
13 changes: 8 additions & 5 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
version: v1beta1

build:
roots:
# Note: these are not local path. These roots are mounted into the docker container
- wasmd/
- cosmos_sdk_dir/third_party/proto/
- cosmos_sdk_dir/proto/
- proto
- third_party/proto
excludes:
# - cosmos_sdk_dir
- third_party/proto/google/protobuf
lint:
use:
- DEFAULT
Expand All @@ -20,6 +19,8 @@ lint:
- RPC_REQUEST_STANDARD_NAME
- PACKAGE_DIRECTORY_MATCH
ignore:
- cosmos
- ibc
- tendermint
- gogoproto
- cosmos_proto
Expand All @@ -29,6 +30,8 @@ breaking:
use:
- FILE
ignore:
- cosmos
- ibc
- tendermint
- gogoproto
- cosmos_proto
Expand Down
2 changes: 1 addition & 1 deletion doc/README.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Generated doc
# Generated doc only

Tutorials and project doc is available on https://docs.cosmwasm.com/
Loading