-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
58 lines (46 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
BAZEL = bazelisk
PROTO_SRC_DIR=proto
PROTO_API_DIR=api
.PHONY: help
help: Makefile
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
.PHONY: buildall
buildall:
go build ./...
.PHONY: update-go-bazel-files
update-go-bazel-files:
$(BAZEL) run //:gazelle -- update ./
.PHONY: update-go-bazel-deps
update-go-bazel-deps:
$(BAZEL) run //:gazelle -- update-repos -from_file=go.mod -to_macro=go_repositories.bzl%go_repositories
.PHONY: gazelle
gazelle: update-go-bazel-deps update-go-bazel-files
.PHONY: bazel-build
bazel-build:
$(BAZEL) build //...
.PHONY: bazel-test
bazel-test:
$(BAZEL) test //...
.PHONY: bazel-test-nocache
bazel-test-nocache:
$(BAZEL) test --cache_test_results=no //...
.PHONY: install-tools
install-tools:
go generate ./tools.go
.PHONY: code-format
code-format:
gofumpt -w -l .
gci write --Section Standard --Section Default --Section "Prefix(zntr.io/hexagonal-bazel)" .
.PHONY: regenerate-api
regenerate-api: install-tools
rm -rf $(PROTO_API_DIR) 2>/dev/null
mkdir $(PROTO_API_DIR)
protoc -I $(PROTO_SRC_DIR) \
--experimental_allow_proto3_optional \
--plugin=protoc-gen-go=bin/protoc-gen-go \
--plugin=protoc-gen-go-grpc=bin/protoc-gen-go-grpc \
--plugin=protoc-gen-connect-go=bin/protoc-gen-connect-go \
--go_opt=paths=source_relative --go_out=$(PROTO_API_DIR) \
--go-grpc_opt=paths=source_relative --go-grpc_out=$(PROTO_API_DIR) \
--go-connect_opt=paths=source_relative --go-connect_out=$(PROTO_API_DIR) \
$(shell find $(PROTO_SRC_DIR) -iname "*.proto")