forked from cadence-workflow/cadence
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
64 lines (47 loc) · 1.56 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
.PHONY: test bins clean
PROJECT_ROOT = github.com/uber/cadence
export PATH := $(GOPATH)/bin:$(PATH)
THRIFT_GENDIR=.gen
# default target
default: test
# define the list of thrift files the service depends on
# (if you have some)
THRIFT_SRCS = idl/github.com/uber/cadence/cadence.thrift \
idl/github.com/uber/cadence/shared.thrift \
idl/github.com/uber/cadence/history.thrift \
idl/github.com/uber/cadence/matching.thrift \
PROGS = cadence
TEST_ARG ?= -race -v -timeout 5m
BUILD := ./build
export PATH := $(GOPATH)/bin:$(PATH)
THRIFT_GEN=$(GOPATH)/bin/thrift-gen
define thriftrule
THRIFT_GEN_SRC += $(THRIFT_GENDIR)/go/$1/tchan-$1.go
$(THRIFT_GENDIR)/go/$1/tchan-$1.go:: $2 $(THRIFT_GEN)
@mkdir -p $(THRIFT_GENDIR)/go
$(ECHO_V)$(THRIFT_GEN) --generateThrift --packagePrefix $(PROJECT_ROOT)/$(THRIFT_GENDIR)/go/ --inputFile $2 --outputDir $(THRIFT_GENDIR)/go \
$(foreach template,$(THRIFT_TEMPLATES), --template $(template))
endef
$(foreach tsrc,$(THRIFT_SRCS),$(eval $(call \
thriftrule,$(basename $(notdir \
$(shell echo $(tsrc) | tr A-Z a-z))),$(tsrc))))
# Automatically gather all srcs
ALL_SRC := $(shell find . -name "*.go" | grep -v -e Godeps -e vendor \
-e ".*/\..*" \
-e ".*/_.*" \
-e ".*/mocks.*")
# all directories with *_test.go files in them
TEST_DIRS := $(sort $(dir $(filter %_test.go,$(ALL_SRC))))
thriftc: $(THRIFT_GEN_SRC)
bins: thriftc
glide install
go build -i -o cadence main.go
test: bins
@rm -f test
@rm -f test.log
@for dir in $(TEST_DIRS); do \
go test -coverprofile=$@ "$$dir" | tee -a test.log; \
done;
clean:
rm -rf .gen
rm -rf cadence