-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (59 loc) · 2.24 KB
/
Makefile
File metadata and controls
77 lines (59 loc) · 2.24 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
BIN_DIR = $(shell pwd)/bin
.PHONY: all
all: lint test
.PHONY: clean
clean: tools-clean
rm -rf dependencies
.PHONY: tidy
tidy:
go mod tidy
cd examples && go mod tidy
cd tools && go mod tidy
.PHONY: update
update:
go get -t -u all
go mod tidy
cd examples && go get -t -u all
cd examples && go mod tidy
cd tools && go list -f '{{if and (not .Indirect) (not .Main)}}{{.Path}}{{end}}' -m all | xargs go get --tags tools -t -u
cd tools && go mod tidy
dependencies: go.mod go.sum
go mod download
touch dependencies
examples/dependencies: examples/go.mod examples/go.sum
cd examples && go mod download
touch examples/dependencies
.PHONY: test
test: dependencies
go test -count 1 -timeout 5m ./...
cd examples && go test -count 1 -timeout 5m ./...
.PHONY: lint
lint: bin/golangci-lint
bin/golangci-lint config verify
GOWORK="$(shell pwd)/.golangci.go.work" bin/golangci-lint run ./... ./examples/...
.PHONY: tools
tools: bin/buf bin/golangci-lint bin/protoc-gen-buf-breaking bin/protoc-gen-buf-lint bin/protoc-gen-go
.PHONY: tools-clean
tools-clean:
rm -rf bin
rm -rf tools/dependencies
tools/dependencies: tools/go.mod tools/go.sum tools/tools.go
cd tools && go mod download
touch tools/dependencies
bin/buf: tools/dependencies
cd tools && go build -o ../bin/buf github.com/bufbuild/buf/cmd/buf
bin/golangci-lint: tools/dependencies
cd tools && go build -o ../bin/golangci-lint github.com/golangci/golangci-lint/v2/cmd/golangci-lint
bin/protoc-gen-buf-breaking: tools/dependencies
cd tools && go build -o ../bin/protoc-gen-buf-breaking github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking
bin/protoc-gen-buf-lint: tools/dependencies
cd tools && go build -o ../bin/protoc-gen-buf-lint github.com/bufbuild/buf/cmd/protoc-gen-buf-lint
bin/protoc-gen-go: tools/dependencies
cd tools && go build -o ../bin/protoc-gen-go google.golang.org/protobuf/cmd/protoc-gen-go
.PHONY: proto
proto: bin/buf bin/protoc-gen-buf-breaking bin/protoc-gen-buf-lint bin/protoc-gen-go
PATH="$(BIN_DIR):$$PATH" buf lint
find examples -type f -name '*.pb.go' -exec rm {} \;
(cd examples && PATH="$(BIN_DIR):$$PATH" buf generate --template buf.gen.yaml)
find internal -type f -name '*.pb.go' -exec rm {} \;
(cd internal && PATH="$(BIN_DIR):$$PATH" buf generate --template buf.gen.yaml)