-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.folder
More file actions
118 lines (104 loc) · 2.92 KB
/
Copy pathMakefile.folder
File metadata and controls
118 lines (104 loc) · 2.92 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
DIRS += $(shell find */* -maxdepth 0 -name Makefile -exec dirname "{}" \;)
default: precommit
.PHONY: precommit
precommit:
@for i in $(DIRS); do \
echo "precommit $${i}"; \
(cd $(CURDIR)/$$i && make precommit) || exit 1; \
done
.PHONY: ensure
ensure:
@for i in $(DIRS); do \
echo "ensure $${i}"; \
(cd $(CURDIR)/$$i && make ensure) || exit 1; \
done
.PHONY: test
test:
@for i in $(DIRS); do \
echo "test $${i}"; \
(cd $(CURDIR)/$$i && make test) || exit 1; \
done
.PHONY: format
format:
@for i in $(DIRS); do \
echo "format $${i}"; \
(cd $(CURDIR)/$$i && make format) || exit 1; \
done
.PHONY: lint
lint:
@for i in $(DIRS); do \
echo "lint $${i}"; \
(cd $(CURDIR)/$$i && make lint) || exit 1; \
done
.PHONY: check
check:
@for i in $(DIRS); do \
echo "check $${i}"; \
(cd $(CURDIR)/$$i && make check) || exit 1; \
done
.PHONY: build
build:
@for i in $(DIRS); do \
echo "build $${i}"; \
(cd $(CURDIR)/$$i && make build) || exit 1; \
done
.PHONY: clean
clean:
@for i in $(DIRS); do \
echo "clean $${i}"; \
(cd $(CURDIR)/$$i && make clean) || exit 1; \
done
.PHONY: buca
buca:
@for i in $(DIRS); do \
echo "buca $${i}"; \
(cd $(CURDIR)/$$i && make buca) || exit 1; \
done
.PHONY: apply
apply:
@for i in $(DIRS); do \
echo "apply $${i}"; \
(cd $(CURDIR)/$$i && make apply) || exit 1; \
done
gomodtidy:
find $$(pwd) -name go.mod -not -path "*/vendor/*" -exec dirname {} + \
| sort -u \
| xargs -I {} sh -c ' \
echo "go mod tidy {}"; \
(cd "{}" && go mod tidy && go run -mod=mod github.com/shoenig/go-modtool -w fmt go.mod) \
'
# gocommit: Commit only if dirty, run precommit, soft reset on failure.
.PHONY: gocommit
gocommit:
@for dir in `pwd`/lib $$(find `pwd` \( -name lib -o -name vendor \) -prune -o -name go.mod -exec dirname "{}" \; | sort); do \
cd "$${dir}" && \
echo "precommit + commit started for $${dir}" && \
((git diff --quiet -- . && git diff --cached --quiet -- . && test -z "$$(git ls-files --others --exclude-standard -- .)" && \
echo "nothing changed => skip") || \
(make precommit && \
git add -- . && \
(git diff --cached --quiet -- . && \
echo "nothing changed after precommit => skip" || \
(git commit -m"make precommit of $${dir}" -- . && \
echo "precommit + commit completed for $${dir}"))) || \
(git reset -- . && \
echo "precommit + commit failed for $${dir}")) \
done
.PHONY: fix
fix:
@for dir in $$(find `pwd` -type d -name vendor -prune -o -name go.mod -exec dirname "{}" \; | grep -v '^$$'); do \
cd $${dir}; \
echo "fix $${dir}"; \
go get \
github.com/IBM/sarama@latest \
github.com/bborbe/agent/lib@latest \
github.com/bborbe/argument/v2@latest \
github.com/bborbe/badgerkv@latest \
github.com/bborbe/boltkv@latest \
github.com/bborbe/kv@latest \
github.com/bborbe/memorykv@latest \
github.com/containerd/containerd@latest \
github.com/go-git/go-git/v5@latest \
golang.org/x/crypto@latest \
golang.org/x/net@latest; \
done