-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (51 loc) · 1.26 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
PATH := bin:$(PATH)
EXEC := $(if $(shell which podman), podman, docker)
default: test
go mod tidy
.PHONY: gen
gen:
protoc \
-I $(PWD)/gen/svc \
-I /usr/local/include \
--go_out=$(shell echo ${GOPATH})/src \
--go-grpc_out=$(shell echo ${GOPATH})/src \
$(PWD)/gen/svc/annotations.proto
.PHONY: install
install: gen
go install
.PHONY: build gen
build:
@go build -o bin/protoc-gen-go-svc main.go
.PHONY: example
example: build
@protoc \
-I . \
-I $(PWD)/example/proto \
-I /usr/local/include \
--go_opt=paths=source_relative \
--go_out=example/proto/go \
--go-grpc_opt=paths=source_relative \
--go-grpc_out=example/proto/go \
--go-svc_opt=private_package=example.private,verbose=false,paths=source_relative \
--go-svc_out=example/proto/go \
v1/service.proto \
v2/service.proto \
private/service.proto
@cd example && go build -o build/people-api cmd/people-api/main.go
.PHONY: test
test: example
cd example && go test ./... -v
ci-shell:
${EXEC} run \
--privileged \
--rm \
-v $(PWD):/go/src/github.com/dane/protoc-gen-go-svc \
-ti ghcr.io/dane/protoc-gen-go-svc \
/bin/bash
.PHONY: diff
diff: example
@go mod tidy
@test `git diff | wc -l` -eq 0
.PHONY: container
container:
${EXEC} build -t ghcr.io/dane/protoc-gen-go-svc .