46 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

2021-01-10 15:31:37 +08:00
.PHONY:all
clean:
2021-01-16 16:28:32 +08:00
rm -rf ./gen/proto* /gen/openapi2/*
2021-01-10 15:31:37 +08:00
gofmt:
2021-01-16 16:28:32 +08:00
find . -name "*.go" \
-not -path "./gen" \
-not -path ".git/*" \
| xargs gofmt -s -d -w
2021-01-10 15:31:37 +08:00
all:
protoc \
2021-01-16 16:28:32 +08:00
--proto_path ./protos \
--go_out ./gen/proto --go_opt paths=source_relative \
--go-grpc_out ./gen/proto --go-grpc_opt paths=source_relative \
--grpc-gateway_out ./gen/proto \
2021-01-10 15:31:37 +08:00
--grpc-gateway_opt paths=source_relative \
--grpc-gateway_opt logtostderr=true \
--grpc-gateway_opt generate_unbound_methods=true \
2021-01-16 16:28:32 +08:00
--openapiv2_out ./gen/openapi2 \
2021-01-10 15:31:37 +08:00
--openapiv2_opt logtostderr=true \
2021-01-16 16:28:32 +08:00
./protos/echo/v1/echo.proto
2021-01-10 15:31:37 +08:00
grpc:
protoc \
2021-01-16 16:28:32 +08:00
--proto_path ./protos \
--go_out ./gen/proto --go_opt paths=source_relative \
--go-grpc_out ./gen/proto --go-grpc_opt paths=source_relative \
./protos/echo/v1/echo.proto
2021-01-10 15:31:37 +08:00
gateway:
protoc \
2021-01-16 16:28:32 +08:00
--proto_path ./protos \
--grpc-gateway_out ./gen/proto \
2021-01-10 15:31:37 +08:00
--grpc-gateway_opt paths=source_relative \
--grpc-gateway_opt logtostderr=true \
--grpc-gateway_opt generate_unbound_methods=true \
2021-01-16 16:28:32 +08:00
./protos/echo/v1/echo.proto
2021-01-10 15:31:37 +08:00
openapi:
protoc \
2021-01-16 16:28:32 +08:00
--proto_path ./protos \
--openapiv2_out ./gen/openapi2 \
2021-01-10 15:31:37 +08:00
--openapiv2_opt logtostderr=true \
2021-01-17 05:32:41 +08:00
/protos/echo/v1/echo.proto