-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
87 lines (67 loc) · 2.17 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
.PHONY: setup setup_dep setup_test setup_mobile setup_linter deps install test fmt lint android proto clean clean_deps run
ALL = ./...
# All .go files not in vendor directory
ALL_GO := $(shell find . -type f -name '*.go' -not -path "./vendor/*")
all: install
# Setup and update all the required tools
setup: setup_dep setup_test setup_linter setup_mobile
setup_dep:
go get -u github.com/golang/dep/cmd/dep
setup_test:
go get -u github.com/stretchr/testify/assert
setup_mobile:
go get -u golang.org/x/mobile/cmd/gomobile
gomobile init
setup_linter:
go get -u github.com/alecthomas/gometalinter
gometalinter --install --update
# Runs dep ensure to populate the vendor directory with
# the required dependencies and potentially modify Gopkg.lock.
deps:
dep ensure -v
# Install go package to produce emmy binaries
install:
go install
# Install to produce emmy binary, but also add version information
# Use with "make release version=x.y.z"
release:
go install -ldflags "-X main.version=$(version)" emmy.go
# Run test for all packages and report test coverage status
test:
go test -v -cover $(ALL)
# Run integration tests with a real redis db instance
test-integration:
go test -v -cover ./client -db
# Lists and formats all go source files with goimports
fmt:
# List of files with different formatting than goimports'
@goimports -l $(ALL_GO)
@goimports -w $(ALL_GO)
# Displays output from several linters
# Auto-generated code for protobuffers is excluded from this check
lint:
-gometalinter --exclude=.*.pb.go \
--enable=gofmt \
--enable=goimports \
--enable=gosimple \
--enable=misspell \
--vendor \
$(ALL)
# Generates Android archive (AAR) for emmy's client compatibility package
android:
gomobile bind -v -o emmy.aar github.com/xlab-si/emmy/client/compatibility
# Generates protobuffer code based on protobuffer definitions
# Requires protoc compiler
proto:
protoc -I proto/ \
proto/messages.proto \
proto/services.proto \
--go_out=plugins=grpc:proto
# Removes temporary files produced by the targets
clean:
-rm emmy.aar emmy-sources.jar
clean_deps:
-rm -rf vendor
# Rebuilds emmy server and starts emmy server and redis instance
run:
docker-compose up --build