From d6d61cf4d12ed4549f1f599d376d1329ad9f3568 Mon Sep 17 00:00:00 2001 From: MYLS Date: Wed, 26 Sep 2018 13:20:22 +0800 Subject: [PATCH] Make package naming meet Go requirements and --- .gitignore | 6 ++++++ bdchain/api/ac_chain.proto | 2 +- bdchain/api/common.proto | 2 +- bdchain/api/tx_ledger.proto | 2 +- gen.bat | 14 ++++++++++---- 5 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 0d3dd0a..aba9421 100644 --- a/.gitignore +++ b/.gitignore @@ -73,3 +73,9 @@ $RECYCLE.BIN/ # End of https://www.gitignore.io/api/windows,osx,linux,jebtrain + +# For this project + +/gen/ + +# End this project diff --git a/bdchain/api/ac_chain.proto b/bdchain/api/ac_chain.proto index e965743..3d1cea9 100644 --- a/bdchain/api/ac_chain.proto +++ b/bdchain/api/ac_chain.proto @@ -4,7 +4,7 @@ package bdchain.api; import "bdchain/api/common.proto"; -option go_package = "bdchain/api/ac_chain"; +option go_package = "bdchain/api/grpc/acchain"; option java_package = "bdchain.api.grpc"; option java_outer_classname = "AccountingChainProto"; option java_multiple_files = true; diff --git a/bdchain/api/common.proto b/bdchain/api/common.proto index 2aa65c8..daeb65e 100644 --- a/bdchain/api/common.proto +++ b/bdchain/api/common.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package bdchain.api; -option go_package = "bdchain/api/common"; +option go_package = "bdchain/api/grpc/common"; option java_package = "bdchain.api.grpc"; option java_outer_classname = "CommonProto"; option java_multiple_files = true; diff --git a/bdchain/api/tx_ledger.proto b/bdchain/api/tx_ledger.proto index f82e235..d47e7f1 100644 --- a/bdchain/api/tx_ledger.proto +++ b/bdchain/api/tx_ledger.proto @@ -5,7 +5,7 @@ package bdchain.api; import "google/protobuf/empty.proto"; import "bdchain/api/common.proto"; -option go_package = "bdchain/api/tx_ledger"; +option go_package = "bdchain/api/grpc/txledger"; option java_package = "bdchain.api.grpc"; option java_outer_classname = "TransactionLedgerProto"; option java_multiple_files = true; diff --git a/gen.bat b/gen.bat index 1d4836f..d3f2a82 100644 --- a/gen.bat +++ b/gen.bat @@ -1,4 +1,10 @@ -mkdir gen\go -protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/common.proto -protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/tx_ledger.proto -protoc -I . --go_out=plugins=grpc:gen/go bdchain/api/ac_chain.proto +@echo off +set dir=.\gen\go + +if not exist %dir% mkdir %dir% +protoc -I . --go_out=plugins=grpc:%dir% bdchain/api/common.proto +protoc -I . --go_out=plugins=grpc:%dir% bdchain/api/tx_ledger.proto +protoc -I . --go_out=plugins=grpc:%dir% bdchain/api/ac_chain.proto + +echo All Done! +pause.