mirror of https://github.com/status-im/consul.git
Add mocks for probuf generation
This commit is contained in:
parent
c4a73a2f60
commit
2c6ef41893
15
GNUmakefile
15
GNUmakefile
|
@ -14,6 +14,8 @@ PROTOC_GEN_GO_GRPC_VERSION="v1.2.0"
|
|||
MOG_VERSION='v0.3.0'
|
||||
PROTOC_GO_INJECT_TAG_VERSION='v1.3.0'
|
||||
|
||||
MOCKED_PB_DIRS= pbdns
|
||||
|
||||
GOTAGS ?=
|
||||
GOPATH=$(shell go env GOPATH)
|
||||
GOARCH?=$(shell go env GOARCH)
|
||||
|
@ -401,9 +403,20 @@ else
|
|||
endif
|
||||
|
||||
.PHONY: proto
|
||||
proto: proto-tools
|
||||
proto: proto-tools proto-gen proto-mocks
|
||||
|
||||
.PHONY: proto-gen
|
||||
proto-gen: proto-tools
|
||||
@$(SHELL) $(CURDIR)/build-support/scripts/protobuf.sh
|
||||
|
||||
.PHONY: proto-mocks
|
||||
proto-mocks:
|
||||
for dir in $(MOCKED_PB_DIRS) ; do \
|
||||
cd proto-public && \
|
||||
rm -f $$dir/mock*.go && \
|
||||
mockery --dir $$dir --inpackage --all --recursive --log-level trace ; \
|
||||
done
|
||||
|
||||
.PHONY: proto-format
|
||||
proto-format: proto-tools
|
||||
@buf format -w
|
||||
|
|
|
@ -60,7 +60,9 @@ function proto_tools_install {
|
|||
local buf_version
|
||||
local mog_version
|
||||
local protoc_go_inject_tag_version
|
||||
local mockery_version
|
||||
|
||||
mockery_version="$(make --no-print-directory print-MOCKERY_VERSION)"
|
||||
protoc_gen_go_version="$(grep github.com/golang/protobuf go.mod | awk '{print $2}')"
|
||||
protoc_gen_go_grpc_version="$(make --no-print-directory print-PROTOC_GEN_GO_GRPC_VERSION)"
|
||||
mog_version="$(make --no-print-directory print-MOG_VERSION)"
|
||||
|
@ -71,6 +73,12 @@ function proto_tools_install {
|
|||
# echo "mog: ${mog_version}"
|
||||
# echo "tag: ${protoc_go_inject_tag_version}"
|
||||
|
||||
install_versioned_tool \
|
||||
'mockery' \
|
||||
'github.com/vektra/mockery/v2' \
|
||||
"${mockery_version}" \
|
||||
'github.com/vektra/mockery/v2'
|
||||
|
||||
install_versioned_tool \
|
||||
'buf' \
|
||||
'github.com/bufbuild/buf' \
|
||||
|
@ -128,15 +136,6 @@ function lint_install {
|
|||
}
|
||||
|
||||
function tools_install {
|
||||
local mockery_version
|
||||
|
||||
mockery_version="$(make --no-print-directory print-MOCKERY_VERSION)"
|
||||
|
||||
install_versioned_tool \
|
||||
'mockery' \
|
||||
'github.com/vektra/mockery/v2' \
|
||||
"${mockery_version}" \
|
||||
'github.com/vektra/mockery/v2'
|
||||
|
||||
lint_install
|
||||
proto_tools_install
|
||||
|
|
Loading…
Reference in New Issue