From 35b4b35eaeff4c96609bd72e2d45ddd2fb5d8daa Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 30 Oct 2018 21:14:48 -0700 Subject: [PATCH] lnrpc: add new recursive proto generation script In this commit, we add a recursive proto generation script. This avoids having to add a new script for each upcoming sub-server. --- lnrpc/gen_protos.sh | 17 +++++++++++++++-- lnrpc/rpc.pb.go | 20 +++++++++++++++----- lnrpc/signrpc/gen_protos.sh | 6 ------ lnrpc/signrpc/signer.pb.go | 8 ++++---- 4 files changed, 34 insertions(+), 17 deletions(-) delete mode 100755 lnrpc/signrpc/gen_protos.sh diff --git a/lnrpc/gen_protos.sh b/lnrpc/gen_protos.sh index 6bc0d1c1..3db69c85 100755 --- a/lnrpc/gen_protos.sh +++ b/lnrpc/gen_protos.sh @@ -1,5 +1,7 @@ #!/bin/sh +echo "Generating root gRPC server protos" + # Generate the protos. protoc -I/usr/local/include -I. \ -I$GOPATH/src \ @@ -7,8 +9,6 @@ protoc -I/usr/local/include -I. \ --go_out=plugins=grpc:. \ rpc.proto - - # Generate the REST reverse proxy. protoc -I/usr/local/include -I. \ -I$GOPATH/src \ @@ -22,3 +22,16 @@ protoc -I/usr/local/include -I. \ -I$GOPATH/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \ --swagger_out=logtostderr=true:. \ rpc.proto + +# For each of the sub-servers, we then generate their protos, but a restricted +# set as they don't yet require REST proxies, or swagger docs. +for file in **/*.proto +do + DIRECTORY=$(dirname ${file}) + echo "Generating protos from ${file}, into ${DIRECTORY}" + + protoc -I/usr/local/include -I. \ + -I$GOPATH/src \ + --go_out=plugins=grpc:. \ + ${file} +done diff --git a/lnrpc/rpc.pb.go b/lnrpc/rpc.pb.go index 3f3ba8aa..f39eed68 100644 --- a/lnrpc/rpc.pb.go +++ b/lnrpc/rpc.pb.go @@ -522,7 +522,9 @@ func (m *FeeLimit) String() string { return proto.CompactTextString(m func (*FeeLimit) ProtoMessage() {} func (*FeeLimit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } -type isFeeLimit_Limit interface{ isFeeLimit_Limit() } +type isFeeLimit_Limit interface { + isFeeLimit_Limit() +} type FeeLimit_Fixed struct { Fixed int64 `protobuf:"varint,1,opt,name=fixed,oneof"` @@ -789,7 +791,9 @@ func (m *ChannelPoint) String() string { return proto.CompactTextStri func (*ChannelPoint) ProtoMessage() {} func (*ChannelPoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } -type isChannelPoint_FundingTxid interface{ isChannelPoint_FundingTxid() } +type isChannelPoint_FundingTxid interface { + isChannelPoint_FundingTxid() +} type ChannelPoint_FundingTxidBytes struct { FundingTxidBytes []byte `protobuf:"bytes,1,opt,name=funding_txid_bytes,proto3,oneof"` @@ -2046,7 +2050,9 @@ func (m *CloseStatusUpdate) String() string { return proto.CompactTex func (*CloseStatusUpdate) ProtoMessage() {} func (*CloseStatusUpdate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{47} } -type isCloseStatusUpdate_Update interface{ isCloseStatusUpdate_Update() } +type isCloseStatusUpdate_Update interface { + isCloseStatusUpdate_Update() +} type CloseStatusUpdate_ClosePending struct { ClosePending *PendingUpdate `protobuf:"bytes,1,opt,name=close_pending,oneof"` @@ -2327,7 +2333,9 @@ func (m *OpenStatusUpdate) String() string { return proto.CompactText func (*OpenStatusUpdate) ProtoMessage() {} func (*OpenStatusUpdate) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{50} } -type isOpenStatusUpdate_Update interface{ isOpenStatusUpdate_Update() } +type isOpenStatusUpdate_Update interface { + isOpenStatusUpdate_Update() +} type OpenStatusUpdate_ChanPending struct { ChanPending *PendingUpdate `protobuf:"bytes,1,opt,name=chan_pending,oneof"` @@ -4668,7 +4676,9 @@ func (m *PolicyUpdateRequest) String() string { return proto.CompactT func (*PolicyUpdateRequest) ProtoMessage() {} func (*PolicyUpdateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{102} } -type isPolicyUpdateRequest_Scope interface{ isPolicyUpdateRequest_Scope() } +type isPolicyUpdateRequest_Scope interface { + isPolicyUpdateRequest_Scope() +} type PolicyUpdateRequest_Global struct { Global bool `protobuf:"varint,1,opt,name=global,oneof"` diff --git a/lnrpc/signrpc/gen_protos.sh b/lnrpc/signrpc/gen_protos.sh deleted file mode 100755 index 86a583a8..00000000 --- a/lnrpc/signrpc/gen_protos.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -protoc -I/usr/local/include -I. \ - -I$GOPATH/src \ - --go_out=plugins=grpc:. \ - signer.proto diff --git a/lnrpc/signrpc/signer.pb.go b/lnrpc/signrpc/signer.pb.go index c0ed582d..4a568764 100644 --- a/lnrpc/signrpc/signer.pb.go +++ b/lnrpc/signrpc/signer.pb.go @@ -1,11 +1,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: signer.proto +// source: signrpc/signer.proto /* Package signrpc is a generated protocol buffer package. It is generated from these files: - signer.proto + signrpc/signer.proto It has these top-level messages: KeyLocator @@ -441,10 +441,10 @@ var _Signer_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "signer.proto", + Metadata: "signrpc/signer.proto", } -func init() { proto.RegisterFile("signer.proto", fileDescriptor0) } +func init() { proto.RegisterFile("signrpc/signer.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ // 465 bytes of a gzipped FileDescriptorProto