Skip to content

Commit a98c59a

Browse files
committed
Upgrade go protobuff from 3-beta to 3
The protobuf files now are compiled when you run "make protos", or when they change. https://jira.hyperledger.org/browse/FAB-108 https://jira.hyperledger.org/browse/FAB-109 Change-Id: I5bfabac127f5a4095f4bca826f245c0139b28efd Signed-off-by: Yacov Manevich <[email protected]>
1 parent 17f69bd commit a98c59a

File tree

720 files changed

+164760
-9621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

720 files changed

+164760
-9621
lines changed

Makefile

+14-4
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
7171
PROJECT_FILES = $(shell git ls-files)
7272
IMAGES = base src ccenv peer membersrvc javaenv
7373

74+
PROTOS=$(shell find . -name "*.proto" | grep -v "vendor" | grep -v "shim/java" | grep -v "/sdk")
75+
76+
PB_GOS=$(patsubst %.proto,%.pb.go,${PROTOS})
7477

7578
all: peer membersrvc checks
7679

@@ -181,13 +184,15 @@ build/image/base/.dummy: $(BASEIMAGE_DEPS)
181184
@touch $@
182185

183186
# Special override for src-image
184-
build/image/src/.dummy: build/image/base/.dummy $(PROJECT_FILES)
187+
build/image/src/.dummy: $(PB_GOS) build/image/base/.dummy $(PROJECT_FILES)
185188
@echo "Building docker src-image"
186189
@mkdir -p $(@D)
187190
@cat images/src/Dockerfile.in \
188191
| sed -e 's/_TAG_/$(DOCKER_TAG)/g' \
189192
> $(@D)/Dockerfile
190-
@git ls-files | tar -jcT - > $(@D)/gopath.tar.bz2
193+
@git ls-files > $(@D)/file_list.txt
194+
@find . -name "*.pb.go" | grep -v vendor >> $(@D)/file_list.txt
195+
@cat $(@D)/file_list.txt | tar -jcT - > $(@D)/gopath.tar.bz2
191196
docker build -t $(PROJECT_NAME)-src $(@D)
192197
docker tag $(PROJECT_NAME)-src $(PROJECT_NAME)-src:$(DOCKER_TAG)
193198
@touch $@
@@ -231,8 +236,13 @@ build/image/%/.dummy: build/image/src/.dummy build/docker/bin/%
231236
@touch $@
232237

233238
.PHONY: protos
234-
protos: gotools
235-
./devenv/compile_protos.sh
239+
protos: gotools ${PB_GOS}
240+
241+
242+
%.pb.go: %.proto
243+
protoc --proto_path=$(abspath $(@D)) --go_out=plugins=grpc:$(abspath $(@D)) $(abspath $(@D)/*.proto)
244+
245+
236246

237247
base-image-clean:
238248
-docker rmi -f $(PROJECT_NAME)-baseimage

consensus/pbft/batch.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ package pbft
1818

1919
import (
2020
"fmt"
21-
"google/protobuf"
2221
"time"
2322

2423
"github.com/hyperledger/fabric/consensus"
2524
"github.com/hyperledger/fabric/consensus/util/events"
2625
pb "github.com/hyperledger/fabric/protos"
2726

2827
"github.com/golang/protobuf/proto"
28+
"github.com/golang/protobuf/ptypes/timestamp"
2929
"github.com/op/go-logging"
3030
"github.com/spf13/viper"
3131
)
@@ -242,7 +242,7 @@ func (op *obcBatch) sendBatch() events.Event {
242242
func (op *obcBatch) txToReq(tx []byte) *Request {
243243
now := time.Now()
244244
req := &Request{
245-
Timestamp: &google_protobuf.Timestamp{
245+
Timestamp: &timestamp.Timestamp{
246246
Seconds: now.Unix(),
247247
Nanos: int32(now.UnixNano() % 1000000000),
248248
},

0 commit comments

Comments
 (0)