update makefile for grpc and grpc tools

This commit is contained in:
c9s 2022-04-07 12:27:06 +08:00
parent fb6834a261
commit ca19c9d592

View File

@ -235,10 +235,26 @@ embed: pkg/server/assets.go
static: frontend/out/index.html pkg/server/assets.go
PROTOS := \
$(wildcard pkg/pb/*.proto)
GRPC_GO_DEPS := $(subst .proto,.pb.go,$(PROTOS))
%.pb.go: %.proto .FORCE
protoc --go-grpc_out=. --go_out=. --proto_path=. $<
grpc: $(GRPC_GO_DEPS) grpc-py
install-grpc-tools:
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.1
pip install grpcio-tools
grpc-py:
python -m grpc_tools.protoc -I$(PWD)/pkg/pb \
--python_out=$(PWD)/python/bbgo \
--grpc_python_out=$(PWD)/python/bbgo \
$(PWD)/pkg/pb/bbgo.proto
.PHONY: bbgo bbgo-slim-darwin bbgo-slim-darwin-amd64 bbgo-slim-darwin-arm64 bbgo-darwin version dist pack migrations static embed desktop .FORCE
protobuf:
protoc -I=$(PWD)/pkg/pb --go_out=$(PWD)/pkg/pb $(PWD)/pkg/pb/bbgo.proto
protobuf-py:
python -m grpc_tools.protoc -I$(PWD)/pkg/pb --python_out=$(PWD)/python/bbgo --grpc_python_out=$(PWD)/python/bbgo $(PWD)/pkg/pb/bbgo.proto