fix #560: fix proto file and Makefile to generate pb (go, js) (#636)

This commit is contained in:
Romanenko Aleksei
2021-10-24 20:34:46 -05:00
committed by GitHub
parent 24c3492541
commit 9d47494585
7 changed files with 288 additions and 267 deletions

View File

@@ -11,7 +11,6 @@ ARCHS ?= amd64
GOFILES := $(shell find . -name "*.go" -type f)
TAGS ?= sqlite
LDFLAGS ?= -X 'main.Version=$(VERSION)'
NODE_PROTOC_PLUGIN := $(shell which grpc_tools_node_protoc_plugin)
ifneq ($(shell uname), Darwin)
EXTLDFLAGS = -extldflags "-static" $(null)
@@ -149,16 +148,14 @@ clean:
find . -name *.db -delete
-rm -rf release dist .cover
rpc/example/node/gorush_*_pb.js: rpc/proto/gorush.proto
@hash grpc_tools_node_protoc_plugin > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
npm install -g grpc-tools; \
fi
protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc=$(NODE_PROTOC_PLUGIN)
generate_proto_js:
npm install grpc-tools
protoc -I rpc/proto rpc/proto/gorush.proto --js_out=import_style=commonjs,binary:rpc/example/node/ --grpc_out=rpc/example/node/ --plugin=protoc-gen-grpc="node_modules/.bin/grpc_tools_node_protoc_plugin"
rpc/proto/gorush.pb.go: rpc/proto/gorush.proto
protoc -I rpc/proto rpc/proto/gorush.proto --go_out=plugins=grpc:rpc/proto
generate_proto_go:
protoc -I rpc/proto rpc/proto/gorush.proto --go_out=rpc/proto --go-grpc_out=require_unimplemented_servers=false:rpc/proto
generate_proto: rpc/proto/gorush.pb.go rpc/example/node/gorush_*_pb.js
generate_proto: generate_proto_go generate_proto_js
version:
@echo $(VERSION)