1
+ # Tencent is pleased to support the open source community by making Polaris available.
2
+ #
3
+ # Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4
+ #
5
+ # Licensed under the BSD 3-Clause License (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://opensource.org/licenses/BSD-3-Clause
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software distributed
12
+ # under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
13
+ # CONDITIONS OF ANY KIND, either express or implied. See the License for the
14
+ # specific language governing permissions and limitations under the License.
15
+
16
+ .PHONY : protoc test build protoc/include
17
+
18
+ # 任意平台,如果本地有安装 protoc 环境,均可以使用
19
+ protoc :
20
+ go install github.com/golang/protobuf/protoc-gen-go@latest
21
+ protoc --proto_path=./api -I ./api/protoc/include/ --go_out=plugins=grpc:./api ./api/* .proto
22
+
23
+
24
+ # Linux 环境下如果没有protoc,可以使用 api/protoc 提供的
25
+ PROTOC: =./api/protoc/bin/protoc
26
+ protoc/include :
27
+ ${PROTOC} --proto_path=./api -I ./api/protoc/include/ --go_out=plugins=grpc:./api ./api/* .proto
28
+
29
+ # 构建示例
30
+ build :
31
+ echo ' client building ....'
32
+ go build -o remote-rate-limit-client examples/client/client.go
33
+
34
+ echo 'server-v1 building ...'
35
+ go build -o remote-rate-limit-server-v1 examples/server/v1/server.go
36
+
37
+ echo 'server-v2 building ...'
38
+ go build -o remote-rate-limit-server-v2 examples/server/v2/server.go
39
+
40
+ echo 'server-v3 building...'
41
+ go build -o remote-rate-limit-server-v3 examples/server/v3/server.go
42
+
43
+ # 运行示例应用
44
+ test : build
45
+ echo ' clean old server...'
46
+ ps aux | grep -v " grep" | grep " rate-limit-server" | awk ' {print $$2}' | xargs kill -9
47
+
48
+ echo 'server-v3 running in nohup...'
49
+ ./remote-rate-limit-server-v3 >> server-v3.log 2>&1 &
50
+
51
+ echo 'start client and call plugin server...'
52
+ ./remote-rate-limit-client
0 commit comments