74 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Makefile
		
	
	
		
			Executable File
		
	
	
			
		
		
	
	
			74 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			Makefile
		
	
	
		
			Executable File
		
	
	
| 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:
 | |
| 	cd cmd/rpc/pb && goctl rpc protoc *.proto --go_out=../pb --go-grpc_out=../pb  --zrpc_out=../ --client=false --style=goZero
 | |
| 
 | |
| .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
 | |
| 
 | |
| 
 | |
| .PHONY: apirun
 | |
| # 运行rpc
 | |
| apirun:
 | |
| 	cd cmd/api && go run transfer.go
 | |
| 
 | |
| .PHONY: apivalidate
 | |
| # api有效测试
 | |
| apivalidate:
 | |
| 	cd cmd/api/desc && goctl api validate --api *.api
 | |
| 
 | |
| .PHONY: apiformat
 | |
| # 格式化api文件
 | |
| apiformat:
 | |
| 	cd cmd/api/desc && goctl api format --dir ./
 | |
| 
 | |
| .PHONY: apitodoc
 | |
| # 生成api文档
 | |
| 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
 | |
| 
 | |
| 
 |