Containerized Protobuf generation (#304)
* Docker container based Protobuf generation and linting * Add protobuf comments * Update contrib/prototools-docker/Dockerfile Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update contrib/prototools-docker/Dockerfile Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/wasm/internal/types/msg.proto Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/wasm/internal/types/types.proto Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/bin/sh
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
project_dir=x/wasm/internal/types/
|
||||
cosmos_sdk_dir=$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)
|
||||
PROJECT_PROTO_DIR=x/wasm/internal/types/
|
||||
COSMOS_SDK_DIR=${COSMOS_SDK_DIR:-$(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk)}
|
||||
|
||||
# Generate Go types from protobuf
|
||||
protoc \
|
||||
-I=. \
|
||||
-I="$cosmos_sdk_dir/third_party/proto" \
|
||||
-I="$cosmos_sdk_dir/proto" \
|
||||
--gocosmos_out=Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,plugins=interfacetype+grpc,paths=source_relative:. \
|
||||
$(find "${project_dir}" -maxdepth 1 -name '*.proto')
|
||||
|
||||
# Generate gRPC gateway (*.pb.gw.go in respective modules) files
|
||||
protoc \
|
||||
-I=. \
|
||||
-I="$cosmos_sdk_dir/third_party/proto" \
|
||||
-I="$cosmos_sdk_dir/proto" \
|
||||
-I="$COSMOS_SDK_DIR/third_party/proto" \
|
||||
-I="$COSMOS_SDK_DIR/proto" \
|
||||
--gocosmos_out=Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,plugins=interfacetype+grpc,paths=source_relative:. \
|
||||
--grpc-gateway_out .\
|
||||
--grpc-gateway_opt logtostderr=true \
|
||||
--grpc-gateway_opt paths=source_relative \
|
||||
$(find "${project_dir}" -maxdepth 1 -name '*.proto')
|
||||
--grpc-gateway_opt paths=Mgoogle/protobuf/any.proto=github.com/cosmos/cosmos-sdk/codec/types,Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,paths=source_relative \
|
||||
--doc_out=./doc \
|
||||
--doc_opt=markdown,proto.md \
|
||||
$(find "${PROJECT_PROTO_DIR}" -maxdepth 1 -name '*.proto')
|
||||
|
||||
Reference in New Issue
Block a user