1+ GOHOSTOS: =$(shell go env GOHOSTOS)
2+ GOPATH: =$(shell go env GOPATH)
3+ VERSION =$(shell git describe --tags --always)
4+ BUILDTIME =$(shell date "+% Y-% m-% d % H:% M:% S")
5+ GITCOMMITID =$(shell git rev-parse HEAD)
6+
7+ ifeq ($(GOHOSTOS ) , windows)
8+ # the `find.exe` is different from `find` in bash/shell.
9+ # to see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/find.
10+ # changed to use git-bash.exe to run find cli or other cli friendly, caused of every developer has a Git.
11+ # Git_Bash= $(subst cmd\,bin\bash.exe,$(dir $(shell where git)))
12+ Git_Bash=$(subst \,/,$(subst cmd\,bin\bash.exe,$(dir $(shell where git))))
13+ INTERNAL_PROTO_FILES=$(shell $(Git_Bash) -c "find internal -name *.proto")
14+ API_PROTO_FILES=$(shell $(Git_Bash) -c "find api -name *.proto")
15+ else
16+ INTERNAL_PROTO_FILES=$(shell find internal -name *.proto)
17+ API_PROTO_FILES=$(shell find api -name *.proto)
18+ endif
19+
20+ .PHONY : init
21+ # init env
22+ init :
23+ go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
24+ go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
25+ go install github.com/go-kratos/kratos/cmd/kratos/v2@latest
26+ go install github.com/go-kratos/kratos/cmd/protoc-gen-go-http/v2@latest
27+ go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest
28+
29+ .PHONT : errors
30+ errors :
31+ protoc --proto_path=./api \
32+ --proto_path=./third_party \
33+ --go_out=paths=import:. \
34+ --go-errors_out=paths=import:. \
35+ $(API_PROTO_FILES )
0 commit comments