-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (41 loc) · 1.35 KB
/
Makefile
File metadata and controls
49 lines (41 loc) · 1.35 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
PROTOC_GEN_GO := protoc-gen-go
PROTOC_GEN_GO_GRPC := protoc-gen-go-grpc
PROTOC_GEN_GRPC_GATEWAY := protoc-gen-grpc-gateway
# point to proto files outside service
PROTO_DIR := idl/proto
OPENAPI_DIR := openapi
OUT_DIR := idl_gen
# find all proto files
PROTO_FILES := $(shell find $(PROTO_DIR) -name '*.proto')
## IDL
# proto: $(PROTO_FILES)
# for file in $(PROTO_FILES); do \
# protoc \
# --proto_path=$(PROTO_DIR) \
# --go_out=$(OUT_DIR) \
# --go_opt=paths=source_relative \
# --go-grpc_out=$(OUT_DIR) \
# --go-grpc_opt=paths=source_relative \
# --grpc-gateway_out=$(OUT_DIR) \
# --grpc-gateway_opt=paths=source_relative \
# $$file; \
# done
proto:
buf generate
cd ${OUT_DIR}/go && go mod init github.com/copito/example_grpc/idl_gen/go && go mod tidy
clean_proto:
rm -rf $(OUT_DIR)/*
rm -rf $(OPENAPI_DIR)/*
install_proto:
go install \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway \
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
install_buf:
# proto
sudo apt install -y protobuf-compiler
# sudo go install github.com/grpc-ecosystem/grpc-gateway/v2@latest
# sudo go install google.golang.org/protobuf
# buf
sudo GO111MODULE=on GOBIN=/usr/local/bin go install github.com/bufbuild/buf/cmd/buf@v1.32.1