Browse Source

Use pattern rule for protoc building and \\nolint in generated pb.go files

Signed-off-by: Silas Davis <silas@monax.io>
pull/1987/head
Silas Davis 6 years ago
parent
commit
c9f92f465b
No known key found for this signature in database GPG Key ID: 4CBFD0FF2D395219
5 changed files with 43 additions and 44 deletions
  1. +14
    -13
      Makefile
  2. +1
    -1
      abci/types/types.pb.go
  3. +1
    -1
      libs/common/types.pb.go
  4. +0
    -3
      rpc/grpc/compile.sh
  5. +27
    -26
      rpc/grpc/types.pb.go

+ 14
- 13
Makefile View File

@ -28,16 +28,22 @@ install:
CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' ./cmd/tendermint CGO_ENABLED=0 go install $(BUILD_FLAGS) -tags '$(BUILD_TAGS)' ./cmd/tendermint
######################################## ########################################
### Build ABCI
### Protobuf
protoc_all: protoc_libs protoc_abci protoc_grpc
protoc_abci:
%.pb.go: %.proto
## If you get the following error, ## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory" ## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702 ## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. abci/types/*.proto
protoc $(INCLUDE) $< --gogo_out=plugins=grpc:.
@echo "--> adding nolint declarations to protobuf generated files" @echo "--> adding nolint declarations to protobuf generated files"
@awk '/package types/ { print "//nolint: gas"; print; next }1' abci/types/types.pb.go > abci/types/types.pb.go.new
@mv abci/types/types.pb.go.new abci/types/types.pb.go
@awk -i inplace '/^\s*package \w+/ { print "//nolint" }1' $@
########################################
### Build ABCI
protoc_abci: abci/types/types.pb.go
build_abci: build_abci:
@go build -i ./abci/cmd/... @go build -i ./abci/cmd/...
@ -108,14 +114,7 @@ get_deps_bin_size:
######################################## ########################################
### Libs ### Libs
protoc_libs:
## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. libs/common/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package common/ { print "//nolint: gas"; print; next }1' libs/common/types.pb.go > libs/common/types.pb.go.new
@mv libs/common/types.pb.go.new libs/common/types.pb.go
protoc_libs: libs/common/types.pb.go
gen_certs: clean_certs gen_certs: clean_certs
## Generating certificates for TLS testing... ## Generating certificates for TLS testing...
@ -136,6 +135,8 @@ test_libs: gen_certs
grpc_dbserver: grpc_dbserver:
protoc -I db/remotedb/proto/ db/remotedb/proto/defs.proto --go_out=plugins=grpc:db/remotedb/proto protoc -I db/remotedb/proto/ db/remotedb/proto/defs.proto --go_out=plugins=grpc:db/remotedb/proto
protoc_grpc: rpc/grpc/types.pb.go
######################################## ########################################
### Testing ### Testing


+ 1
- 1
abci/types/types.pb.go View File

@ -43,7 +43,7 @@
PubKey PubKey
Evidence Evidence
*/ */
//nolint: gas
//nolint
package types package types
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"


+ 1
- 1
libs/common/types.pb.go View File

@ -11,7 +11,7 @@
KVPair KVPair
KI64Pair KI64Pair
*/ */
//nolint: gas
//nolint
package common package common
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"


+ 0
- 3
rpc/grpc/compile.sh View File

@ -1,3 +0,0 @@
#! /bin/bash
protoc --gogo_out=plugins=grpc:. -I $GOPATH/src/ -I . types.proto

+ 27
- 26
rpc/grpc/types.pb.go View File

@ -1,11 +1,11 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT. // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: types.proto
// source: rpc/grpc/types.proto
/* /*
Package core_grpc is a generated protocol buffer package. Package core_grpc is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
types.proto
rpc/grpc/types.proto
It has these top-level messages: It has these top-level messages:
RequestPing RequestPing
@ -13,6 +13,7 @@
ResponsePing ResponsePing
ResponseBroadcastTx ResponseBroadcastTx
*/ */
//nolint
package core_grpc package core_grpc
import proto "github.com/gogo/protobuf/proto" import proto "github.com/gogo/protobuf/proto"
@ -208,7 +209,7 @@ var _BroadcastAPI_serviceDesc = grpc.ServiceDesc{
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "types.proto",
Metadata: "rpc/grpc/types.proto",
} }
func (m *RequestPing) Marshal() (dAtA []byte, err error) { func (m *RequestPing) Marshal() (dAtA []byte, err error) {
@ -769,29 +770,29 @@ var (
ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow")
) )
func init() { proto.RegisterFile("types.proto", fileDescriptorTypes) }
func init() { golang_proto.RegisterFile("types.proto", fileDescriptorTypes) }
func init() { proto.RegisterFile("rpc/grpc/types.proto", fileDescriptorTypes) }
func init() { golang_proto.RegisterFile("rpc/grpc/types.proto", fileDescriptorTypes) }
var fileDescriptorTypes = []byte{ var fileDescriptorTypes = []byte{
// 306 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0xa9, 0x2c, 0x48,
0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x4c, 0xce, 0x2f, 0x4a, 0x8d, 0x4f, 0x2f,
0x2a, 0x48, 0x96, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f,
0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0xab, 0x48, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2,
0x53, 0xca, 0x1c, 0x49, 0x79, 0x49, 0x6a, 0x5e, 0x4a, 0x6a, 0x51, 0x6e, 0x66, 0x5e, 0x09, 0x32,
0x33, 0x31, 0x29, 0x39, 0x53, 0x1f, 0x6c, 0x99, 0x3e, 0x92, 0x95, 0x4a, 0xbc, 0x5c, 0xdc, 0x41,
0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x01, 0x99, 0x79, 0xe9, 0x4a, 0x2a, 0x5c, 0x42, 0x50, 0xae,
0x53, 0x51, 0x7e, 0x62, 0x4a, 0x72, 0x62, 0x71, 0x49, 0x48, 0x85, 0x10, 0x1f, 0x17, 0x53, 0x49,
0x85, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4f, 0x10, 0x53, 0x49, 0x85, 0x12, 0x1f, 0x17, 0x4f, 0x50,
0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0x2a, 0x58, 0x57, 0x23, 0x23, 0x97, 0x30, 0x4c, 0x00, 0x59,
0x9f, 0x21, 0x17, 0x47, 0x72, 0x46, 0x6a, 0x72, 0x76, 0x3c, 0x54, 0x37, 0xb7, 0x91, 0x98, 0x1e,
0xc4, 0x72, 0x98, 0x6a, 0x67, 0x90, 0x74, 0x48, 0x45, 0x10, 0x7b, 0x32, 0x84, 0x21, 0x64, 0xce,
0xc5, 0x95, 0x92, 0x9a, 0x93, 0x59, 0x96, 0x5a, 0x04, 0xd2, 0xc4, 0x04, 0xd6, 0x24, 0x81, 0xa6,
0xc9, 0x05, 0xa2, 0x20, 0xa4, 0x22, 0x88, 0x33, 0x05, 0xc6, 0x34, 0x9a, 0xca, 0xc8, 0xc5, 0x03,
0xb7, 0xdb, 0x31, 0xc0, 0x53, 0xc8, 0x9c, 0x8b, 0x05, 0xe4, 0x38, 0x21, 0x31, 0x3d, 0x78, 0xa8,
0xea, 0x21, 0x79, 0x55, 0x4a, 0x1c, 0x45, 0x1c, 0xe1, 0x1b, 0x21, 0x1f, 0x2e, 0x6e, 0x64, 0x4f,
0xc8, 0x62, 0xea, 0x47, 0x92, 0x96, 0x92, 0xc3, 0x62, 0x0c, 0x92, 0xbc, 0x93, 0xc0, 0x89, 0x47,
0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x78, 0xe0, 0xb1, 0x1c, 0x63, 0x12,
0x1b, 0x38, 0xe4, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x14, 0x5e, 0xf8, 0xd5, 0xfb, 0x01,
0x00, 0x00,
// 308 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x29, 0x2a, 0x48, 0xd6,
0x4f, 0x07, 0x11, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x9c,
0xc9, 0xf9, 0x45, 0xa9, 0xf1, 0x20, 0x61, 0x29, 0xdd, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd,
0xe4, 0xfc, 0x5c, 0xfd, 0xf4, 0xfc, 0xf4, 0x7c, 0x7d, 0xb0, 0x8a, 0xa4, 0xd2, 0x34, 0x30, 0x0f,
0xcc, 0x01, 0xb3, 0x20, 0x3a, 0xa5, 0xcc, 0x91, 0x94, 0x97, 0xa4, 0xe6, 0xa5, 0xa4, 0x16, 0xe5,
0x66, 0xe6, 0x95, 0x20, 0x33, 0x13, 0x93, 0x92, 0x33, 0x21, 0x96, 0x21, 0x5b, 0xa9, 0xc4, 0xcb,
0xc5, 0x1d, 0x94, 0x5a, 0x58, 0x9a, 0x5a, 0x5c, 0x12, 0x90, 0x99, 0x97, 0xae, 0xa4, 0xc2, 0x25,
0x04, 0xe5, 0x3a, 0x15, 0xe5, 0x27, 0xa6, 0x24, 0x27, 0x16, 0x97, 0x84, 0x54, 0x08, 0xf1, 0x71,
0x31, 0x95, 0x54, 0x48, 0x30, 0x2a, 0x30, 0x6a, 0xf0, 0x04, 0x31, 0x95, 0x54, 0x28, 0xf1, 0x71,
0xf1, 0x04, 0xa5, 0x16, 0x17, 0xe4, 0xe7, 0x15, 0xa7, 0x82, 0x75, 0x35, 0x32, 0x72, 0x09, 0xc3,
0x04, 0x90, 0xf5, 0x19, 0x72, 0x71, 0x24, 0x67, 0xa4, 0x26, 0x67, 0xc7, 0x43, 0x75, 0x73, 0x1b,
0x89, 0xe9, 0x41, 0x2c, 0x87, 0xa9, 0x76, 0x06, 0x49, 0x87, 0x54, 0x04, 0xb1, 0x27, 0x43, 0x18,
0x42, 0xe6, 0x5c, 0x5c, 0x29, 0xa9, 0x39, 0x99, 0x65, 0xa9, 0x45, 0x20, 0x4d, 0x4c, 0x60, 0x4d,
0x12, 0x68, 0x9a, 0x5c, 0x20, 0x0a, 0x42, 0x2a, 0x82, 0x38, 0x53, 0x60, 0x4c, 0xa3, 0xa9, 0x8c,
0x5c, 0x3c, 0x70, 0xbb, 0x1d, 0x03, 0x3c, 0x85, 0xcc, 0xb9, 0x58, 0x40, 0x8e, 0x13, 0x12, 0xd3,
0x83, 0x87, 0xaa, 0x1e, 0x92, 0x57, 0xa5, 0xc4, 0x51, 0xc4, 0x11, 0xbe, 0x11, 0xf2, 0xe1, 0xe2,
0x46, 0xf6, 0x84, 0x2c, 0xa6, 0x7e, 0x24, 0x69, 0x29, 0x39, 0x2c, 0xc6, 0x20, 0xc9, 0x3b, 0x09,
0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xcb,
0x31, 0x26, 0xb1, 0x81, 0x43, 0xde, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xd5, 0xe6, 0xa2,
0x04, 0x02, 0x00, 0x00,
} }

Loading…
Cancel
Save