Skip to content
Permalink
Browse files

generate Go files from proto file (#1629)

  • Loading branch information
skydoorkai authored and terrytangyuan committed Jan 10, 2020
1 parent 366e7fc commit 2e827b139a4bb57518de402e8494e3259e45709f
Showing with 23 additions and 4 deletions.
  1. +21 −4 elasticdl/Makefile
  2. +1 −0 elasticdl/proto/elasticdl.proto
  3. +1 −0 elasticdl/proto/tensor_dtype.proto
@@ -1,5 +1,22 @@
PYTHON=python
PYTHON = python

elasticdl_pb:
$(PYTHON) -m grpc_tools.protoc -I . elasticdl/proto/tensor_dtype.proto --python_out=.
$(PYTHON) -m grpc_tools.protoc -I . elasticdl/proto/elasticdl.proto --python_out=. --grpc_python_out=.
EDL_PROTO_FILE = elasticdl/proto/elasticdl.proto
TENSOR_DTYPE_PROTO_FILE = elasticdl/proto/tensor_dtype.proto

GO_FILE_DIR = elasticdl/pkg/proto
GO_PB_FILE = $(GO_FILE_DIR)/elasticdl.pb.go
TENSOR_DTYPE_GO_FILE = $(GO_FILE_DIR)/tensor_dtype.pb.go

all: python_pb $(GO_PB_FILE) $(TENSOR_DTYPE_GO_FILE)

python_pb:
$(PYTHON) -m grpc_tools.protoc -I . $(TENSOR_DTYPE_PROTO_FILE) --python_out=.
$(PYTHON) -m grpc_tools.protoc -I . $(EDL_PROTO_FILE) --python_out=. --grpc_python_out=.

$(GO_PB_FILE): $(EDL_PROTO_FILE)
mkdir -p $(GO_FILE_DIR)
protoc -I . $< --go_out=plugins=grpc:.

$(TENSOR_DTYPE_GO_FILE): $(TENSOR_DTYPE_PROTO_FILE)
mkdir -p $(GO_FILE_DIR)
protoc -I . $< --go_out=.
@@ -4,6 +4,7 @@ import "google/protobuf/empty.proto";
import "elasticdl/proto/tensor_dtype.proto";

package master;
option go_package = "elasticdl/pkg/proto";

enum TaskType {
TRAINING = 0;
@@ -1,6 +1,7 @@
syntax = "proto3";

package master;
option go_package = "elasticdl/pkg/proto";

enum TensorDtype{
// Not a legal value for DataType. Used to indicate a DataType field

0 comments on commit 2e827b1

Please sign in to comment.
You can’t perform that action at this time.