-
Notifications
You must be signed in to change notification settings - Fork 9
/
Makefile
65 lines (48 loc) · 1.73 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
# Copyright © 2019 State Street Bank and Trust Company. All rights reserved
#
# SPDX-License-Identifier: Apache-2.0
NAME=protoc-gen-clojure
LEIN = $(shell which lein || echo $(CURDIR)/lein)
BINDIR ?= /usr/local/bin
OUTPUT=target/$(NAME)
COVERAGE_THRESHOLD = 83
COVERAGE_EXCLUSION += "user"
COVERAGE_EXCLUSION += "com.example.*"
COVERAGE_EXCLUSION += "com.google.protobuf.*"
SRCS += $(shell find src -type f)
SRCS += $(shell find resources/generators -type f)
PROTOS += $(wildcard resources/testdata/*.proto)
all: scan test test-example bin
testdata: resources/testdata/protoc.request resources/testdata/toaster.protoc.request
scan:
$(LEIN) cljfmt check
.PHONY: test
test-example:
cd examples/hello && $(LEIN) test
test:
$(LEIN) cloverage --lcov --fail-threshold $(COVERAGE_THRESHOLD) $(patsubst %,-e %, $(COVERAGE_EXCLUSION))
bin: $(OUTPUT)
$(OUTPUT): $(SRCS) Makefile project.clj
@$(LEIN) bin
$(PREFIX)$(BINDIR):
mkdir -p $@
install: $(OUTPUT) $(PREFIX)$(BINDIR)
cp $(OUTPUT) $(PREFIX)$(BINDIR)
resources/testdata/protoc.request: $(PROTOS) Makefile
REQCAPTURE_OUTPUT=$@ protoc \
--reqcapture_out=grpc-server,grpc-client:. \
--plugin=$(CURDIR)/tools/protoc-gen-reqcapture \
--proto_path=$(CURDIR)/resources/testdata \
kitchensink.proto addressbook.proto address-service.proto nested/foobar.proto complex-package.proto \
enum-proto.proto enum-proto2.proto enum-proto3.proto
resources/testdata/toaster.protoc.request: $(PROTOS) Makefile
REQCAPTURE_OUTPUT=$@ protoc \
--reqcapture_out=grpc-server,grpc-client:. \
--plugin=$(CURDIR)/tools/protoc-gen-reqcapture \
--proto_path=$(CURDIR)/resources/testdata \
toaster.proto
clean:
@echo "Cleaning up.."
@$(LEIN) clean
-@rm -rf target
-@rm -f *~