-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
157 lines (116 loc) · 4.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
.PHONY: all
all: engine_swagger engine_proto fs storage_swagger storage_proto logger_swagger logger_proto workflow chat bot call_center swagger_mix
.PHONY: engine_swagger
engine_swagger:
protoc -I/usr/local/include -I./engine -I./ \
--swagger_out=version=false,json_names_for_fields=false,allow_delete_body=true,include_package_in_tags=false,allow_repeated_fields_in_body=false,fqn_for_swagger_name=false,merge_file_name=engine,allow_merge=true:./swagger \
./engine/*.proto
.PHONY: engine_proto
engine_proto:
protoc -I/usr/local/include -I./engine -I./ \
--go-grpc_out=./engine --go-grpc_opt=paths=source_relative \
--go_opt=paths=source_relative \
--go_out=./engine ./engine/*.proto
engine_chat_proto:
protoc -I/usr/local/include -I./engine/chat -I./ \
--go-grpc_out=./engine/chat --go-grpc_opt=paths=source_relative \
--go_opt=paths=source_relative \
--go_out=./engine/chat ./engine/chat/*.proto
engine: engine_proto engine_chat_proto engine_swagger
.PHONY: call_center
call_center:
protoc -I/usr/local/include -I./cc -I./ -I./engine \
--go_opt=paths=source_relative \
--go-grpc_out=./cc --go-grpc_opt=paths=source_relative \
--go_out=./cc ./cc/*.proto
.PHONY: fs
fs:
protoc -I/usr/local/include -I./fs \
--go_opt=paths=source_relative \
--go-grpc_out=./fs --go-grpc_opt=paths=source_relative \
--go_out=./fs ./fs/fs.proto
.PHONY: storage_swagger
storage_swagger:
protoc -I/usr/local/include -I./storage \
-I. \
--swagger_out=version=false,json_names_for_fields=false,allow_delete_body=true,include_package_in_tags=false,allow_repeated_fields_in_body=false,fqn_for_swagger_name=false,merge_file_name=storage,allow_merge=true:./swagger \
./storage/*.proto
.PHONY: storage_proto
storage_proto:
protoc -I/usr/local/include -I./ -I./storage \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--go_opt=paths=source_relative \
--go_out=. ./storage/*.proto
.PHONY: workflow
workflow:
protoc -I/usr/local/include -I./ \
-I./engine/chat \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--go_opt=paths=source_relative \
--go_out=. ./workflow/*.proto
.PHONY: logger_swagger
logger_swagger:
protoc -I/usr/local/include -I./logger -I./ \
--swagger_out=version=false,json_names_for_fields=false,allow_delete_body=true,include_package_in_tags=false,allow_repeated_fields_in_body=false,fqn_for_swagger_name=false,merge_file_name=logger,allow_merge=true:./swagger \
./logger/*.proto
.PHONY: logger_proto
logger_proto:
protoc -I/usr/local/include -I./logger -I./ \
--go-grpc_out=./logger --go-grpc_opt=paths=source_relative \
--go_opt=paths=source_relative \
--go_out=./logger ./logger/*.proto
.PHONY: chat
chat:
protoc \
-I chat -I . \
--go_opt=paths=source_relative --go_out=chat \
--go-grpc_out=paths=source_relative:chat \
\
chat/*.proto
# export GO111MODULE=on # Enable module mode
##### require google.golang.org/protobuf v1.25.0
# go get google.golang.org/protobuf/cmd/[email protected] # *.pb.go
##### require google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.1
# go get google.golang.org/grpc/cmd/[email protected] # *_grpc.pb.go
##### require github.com/micro/micro/v2 v2.9.1
# go get github.com/micro/micro/v2/cmd/[email protected] # *.pb.micro.go
.PHONY: bot
bot:
protoc \
-I ./bot \
-I ./chat \
--go_opt=paths=source_relative --go_out=bot \
--go-grpc_out=paths=source_relative:bot \
\
./bot/*.proto
.PHONY: messages
messages:
protoc -I . \
--go_opt=paths=source_relative --go_out=. \
--go-grpc_out=paths=source_relative:. \
\
chat/messages/*.proto
.PHONY: messages_swagger
messages_swagger:
protoc -I . \
--openapiv2_out=merge_file_name=messages,allow_merge=true,openapi_naming_strategy=fqn,json_names_for_fields=false,disable_default_errors=true,repeated_path_param_separator=csv,logtostderr=true:swagger \
chat/messages/openapiv2.proto \
chat/messages/catalog.proto
.PHONY: contacts_proto
contacts_proto:
protoc -I . \
--go_opt=paths=source_relative --go_out=. \
--go-grpc_out=. --go-grpc_opt=paths=source_relative \
--micro_out=plugins=grpc,paths=source_relative:. \
gateway/contacts/*.proto
.PHONY: swagger_mix
swagger_mix:
go run github.com/msample/swagger-mixin@latest ./swagger/engine.swagger.json ./swagger/storage.swagger.json \
./swagger/messages.swagger.json ./swagger/logger.swagger.json ./swagger/contacts.swagger.json ./swagger/webitel-go.swagger.json ./swagger/wfm.swagger.json ./swagger/knowledgebase.swagger.json ./swagger/cases.swagger.json > ./swagger/api.json | true
.PHONY: clean
clean:
rm -rf ./engine/*.go
rm -rf ./fs/*.go
rm -rf ./storage/*.go
rm -rf ./workflow/*.go
rm -rf ./swagger/*