-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (32 loc) · 1.02 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
SRC_MAIN_PROTO_DIR=src/main/proto
GITHUB_TH2=github.com/th2-net
TH2_GRPC_COMMON=th2-grpc-common
TH2_GRPC_COMMON_URL=$(GITHUB_TH2)/$(TH2_GRPC_COMMON)@4.3.0-dev
MODULE_DIR=pkg/common/grpc
PROTOC_VERSION=21.12
init-work-space: clean-grpc-module prepare-grpc-module configure-grpc-generator generate-grpc-files tidy
configure-grpc-generator:
go install google.golang.org/protobuf/cmd/[email protected]
clean-grpc-module:
-rm -rf $(MODULE_DIR)
prepare-grpc-module:
- mkdir $(MODULE_DIR)
cd $(MODULE_DIR)
cd $(MODULE_DIR) \
&& go get $(TH2_GRPC_COMMON_URL) \
&& go get google.golang.org/[email protected] \
&& go get github.com/google/[email protected]
generate-grpc-files:
$(eval $@_PROTO_DIR := $(shell go list -m -f '{{.Dir}}' $(TH2_GRPC_COMMON_URL))/$(SRC_MAIN_PROTO_DIR))
protoc \
--go_out=$(MODULE_DIR) \
--go_opt=paths=source_relative \
--proto_path=$($@_PROTO_DIR) \
$(shell find $($@_PROTO_DIR) -name '*.proto' )
tidy:
go mod tidy -v
build:
go vet ./...
go build -v ./...
run-test:
go test -v -race ./...