2024-06-07 11:11:04 +08:00
|
|
|
GOHOSTOS:=$(shell go env GOHOSTOS)
|
|
|
|
GOPATH:=$(shell go env GOPATH)
|
|
|
|
VERSION=$(shell git describe --tags --always)
|
|
|
|
|
|
|
|
|
|
|
|
ifeq ($(GOHOSTOS), windows)
|
|
|
|
#the `find.exe` is different from `find` in bash/shell.
|
|
|
|
#to see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/find.
|
|
|
|
#changed to use git-bash.exe to run find cli or other cli friendly, caused of every developer has a Git.
|
|
|
|
#Git_Bash= $(subst cmd\,bin\bash.exe,$(dir $(shell where git)))
|
|
|
|
Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))
|
|
|
|
INTERNAL_PROTO_FILES=$(shell $(Git_Bash) -c "find internal -name *.proto")
|
|
|
|
API_PROTO_FILES=$(shell $(Git_Bash) -c "find api -name *.proto")
|
|
|
|
else
|
|
|
|
INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
|
|
|
|
API_PROTO_FILES=$(shell find api -name *.proto)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: apigen
|
|
|
|
# 根据api创建http文件
|
|
|
|
apigen:
|
|
|
|
cd cmd/api/desc && goctl api go -api *.api -dir ../ --style=goZero
|
|
|
|
|
|
|
|
.PHONY: rpcgen
|
|
|
|
# 根据protoc创建rpc文件
|
|
|
|
rpcgen:
|
2024-11-06 17:35:59 +08:00
|
|
|
cd cmd/rpc/pb && goctl rpc protoc transfer.proto --go_out=../pb --go-grpc_out=../pb --zrpc_out=../ --client=true --style=goZero
|
2024-06-07 11:11:04 +08:00
|
|
|
|
|
|
|
.PHONY: apiinitrpc
|
|
|
|
# api端生成rpc
|
|
|
|
apiinitrpc:
|
|
|
|
cd cmd/api/pb && goctl rpc protoc *.proto --go_out=../ --go-grpc_out=../ --zrpc_out=../ --client=false --style=goZero
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: rpcrun
|
|
|
|
# 运行rpc
|
|
|
|
rpcrun:
|
|
|
|
cd cmd/rpc && go run transfer.go
|
|
|
|
|
|
|
|
|
2024-06-12 13:46:14 +08:00
|
|
|
.PHONY: qrun
|
|
|
|
# 运行rpc
|
|
|
|
qrun:
|
|
|
|
cd cmd/rpc/queue && go run queue.go
|
|
|
|
|
|
|
|
|
2024-06-07 11:11:04 +08:00
|
|
|
.PHONY: apirun
|
|
|
|
# 运行rpc
|
|
|
|
apirun:
|
|
|
|
cd cmd/api && go run transfer.go
|
|
|
|
|
|
|
|
.PHONY: apivalidate
|
2024-06-07 14:28:29 +08:00
|
|
|
# api有效测试
|
2024-06-07 11:11:04 +08:00
|
|
|
apivalidate:
|
|
|
|
cd cmd/api/desc && goctl api validate --api *.api
|
|
|
|
|
|
|
|
.PHONY: apiformat
|
2024-06-07 14:28:29 +08:00
|
|
|
# 格式化api文件
|
2024-06-07 11:11:04 +08:00
|
|
|
apiformat:
|
|
|
|
cd cmd/api/desc && goctl api format --dir ./
|
|
|
|
|
|
|
|
.PHONY: apitodoc
|
2024-06-07 14:28:29 +08:00
|
|
|
# 生成api文档
|
2024-06-07 11:11:04 +08:00
|
|
|
apitodoc:
|
|
|
|
cd cmd/api/desc && goctl api doc --dir ./
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: templateUpdate
|
|
|
|
# rpcdocker
|
|
|
|
templateUpdate:
|
|
|
|
cd template && goctl template update --home ./
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: rpcdocker
|
|
|
|
# rpcdocker
|
|
|
|
rpcdocker:
|
|
|
|
goctl docker -go ./cmd/rpc/transfer.go
|
|
|
|
|
|
|
|
|