-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
42 lines (30 loc) · 1.3 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
SHELL :=/bin/bash
all: server
cache := $(shell go env GOMODCACHE)
bin/protoc:
wget --quiet https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-x86_64.zip && unzip -q -o protoc-3.15.8-linux-x86_64.zip
pre:
mkdir -p bin && \
go mod tidy && \
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
google.golang.org/protobuf/cmd/protoc-gen-go \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
proto/helloworld/*.go: proto/helloworld/helloworld.proto bin/protoc pre
bin/protoc -I ./proto \
-I ${cache}/github.com/grpc-ecosystem/grpc-gateway/[email protected]/ \
--go_out ./proto --go_opt paths=source_relative \
--go-grpc_out ./proto --go-grpc_opt paths=source_relative \
--grpc-gateway_out ./proto --grpc-gateway_opt paths=source_relative \
--swagger_out=logtostderr=true:cmd --go-grpc_opt paths=source_relative \
proto/helloworld/helloworld.proto
test: cmd/server.go
go get -u github.com/jstemmer/go-junit-report && \
go test ./... -v | tee >(go-junit-report > report.xml)
server: proto/helloworld/*.go cmd/server.go
go build cmd/server.go
clean:
rm -rf main server proto/helloworld/*.go cmd/helloworld
.PHONY: clean