-
Notifications
You must be signed in to change notification settings - Fork 17
/
Makefile
97 lines (77 loc) · 2.34 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
88
89
90
91
92
93
94
95
96
97
# This makefile probably requires GNU make >= 3.81
GO ?= go
# OS X, use sha256sum or gsha256sum elsewhere
SHASUM := shasum -a 256
VERSION := $(shell git describe)
packages := ./...
fordist := find * -type d -exec
# Should use -mod=readonly in CI
build:
$(GO) build $(packages)
install:
$(GO) install $(packages)
# Use `test all` now for CI? https://research.swtch.com/vgo-cmd
# Re: ginkgo, https://github.com/onsi/ginkgo/issues/278
test:
$(GO) test $(packages)
spec:
ginkgo -r -v
# TODO: coverage for CLI? https://github.com/onsi/ginkgo/issues/89
coverage:
$(GO) test --covermode count --coverprofile connect.coverprofile .
$(GO) tool cover --func connect.coverprofile
browse-coverage: coverage
$(GO) tool cover --html connect.coverprofile
check: lint errcheck
lint:
golint --set_exit_status ./...
errcheck:
errcheck --asserts --exclude=err-excludes.txt $(packages)
zen:
ginkgo watch -notify $(packages)
get-devtools:
@echo Getting golint...
$(GO) install golang.org/x/lint/golint
@echo Getting errcheck...
$(GO) install github.com/kisielk/errcheck
get-reltools:
@echo Getting gox...
$(GO) install github.com/mitchellh/gox
dist: test
@echo Cross-compiling binaries...
gox -verbose \
-ldflags "-s -w" \
-os="darwin linux windows" \
-arch="amd64 386" \
-output="dist/{{.OS}}-{{.Arch}}/{{.Dir}}" ./cmd/...
release: dist
@echo Preparing distributions...
@cd dist && \
$(fordist) sh -c 'gpg --detach-sign --armor {}/kafka-connect*' \; && \
$(fordist) cp ../LICENSE {} \; && \
$(fordist) cp ../README.md {} \; && \
$(fordist) cp ../HISTORY.md {} \; && \
$(fordist) tar -zcf kafka-connect-${VERSION}-{}.tar.gz {} \; && \
$(fordist) zip -r kafka-connect-${VERSION}-{}.zip {} \; && \
echo Computing checksums... && \
find . \( -name '*.tar.gz' -or -name '*.zip' \) -exec \
sh -c '$(SHASUM) {} > {}.sha256sum' \; && \
cd ..
@echo Done
man: install
mkdir -p man
kafka-connect --help-man > man/kafka-connect.1
nroff -man man/kafka-connect.1
@echo
@echo -----------------------------------------
@echo Man page generated at man/kafka-connect.1
@echo -----------------------------------------
clean:
$(RM) *.coverprofile
$(RM) -r man
distclean: clean
$(RM) -r dist/
$(GO) clean -i $(packages)
.PHONY: build install test spec coverage browse-coverage
.PHONY: check lint errcheck zen get-devtools
.PHONY: dist get-reltools man release