Skip to content

Commit

Permalink
Upgrade go protobuff from 3-beta to 3
Browse files Browse the repository at this point in the history
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 <yacovm@il.ibm.com>
  • Loading branch information
yacovm committed Aug 26, 2016
1 parent 17f69bd commit a98c59a
Show file tree
Hide file tree
Showing 720 changed files with 164,760 additions and 9,621 deletions.
18 changes: 14 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
PROJECT_FILES = $(shell git ls-files)
IMAGES = base src ccenv peer membersrvc javaenv

PROTOS=$(shell find . -name "*.proto" | grep -v "vendor" | grep -v "shim/java" | grep -v "/sdk")

PB_GOS=$(patsubst %.proto,%.pb.go,${PROTOS})

all: peer membersrvc checks

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

# Special override for src-image
build/image/src/.dummy: build/image/base/.dummy $(PROJECT_FILES)
build/image/src/.dummy: $(PB_GOS) build/image/base/.dummy $(PROJECT_FILES)
@echo "Building docker src-image"
@mkdir -p $(@D)
@cat images/src/Dockerfile.in \
| sed -e 's/_TAG_/$(DOCKER_TAG)/g' \
> $(@D)/Dockerfile
@git ls-files | tar -jcT - > $(@D)/gopath.tar.bz2
@git ls-files > $(@D)/file_list.txt
@find . -name "*.pb.go" | grep -v vendor >> $(@D)/file_list.txt
@cat $(@D)/file_list.txt | tar -jcT - > $(@D)/gopath.tar.bz2
docker build -t $(PROJECT_NAME)-src $(@D)
docker tag $(PROJECT_NAME)-src $(PROJECT_NAME)-src:$(DOCKER_TAG)
@touch $@
Expand Down Expand Up @@ -231,8 +236,13 @@ build/image/%/.dummy: build/image/src/.dummy build/docker/bin/%
@touch $@

.PHONY: protos
protos: gotools
./devenv/compile_protos.sh
protos: gotools ${PB_GOS}


%.pb.go: %.proto
protoc --proto_path=$(abspath $(@D)) --go_out=plugins=grpc:$(abspath $(@D)) $(abspath $(@D)/*.proto)



base-image-clean:
-docker rmi -f $(PROJECT_NAME)-baseimage
Expand Down
4 changes: 2 additions & 2 deletions consensus/pbft/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ package pbft

import (
"fmt"
"google/protobuf"
"time"

"github.com/hyperledger/fabric/consensus"
"github.com/hyperledger/fabric/consensus/util/events"
pb "github.com/hyperledger/fabric/protos"

"github.com/golang/protobuf/proto"
"github.com/golang/protobuf/ptypes/timestamp"
"github.com/op/go-logging"
"github.com/spf13/viper"
)
Expand Down Expand Up @@ -242,7 +242,7 @@ func (op *obcBatch) sendBatch() events.Event {
func (op *obcBatch) txToReq(tx []byte) *Request {
now := time.Now()
req := &Request{
Timestamp: &google_protobuf.Timestamp{
Timestamp: &timestamp.Timestamp{
Seconds: now.Unix(),
Nanos: int32(now.UnixNano() % 1000000000),
},
Expand Down
Loading

0 comments on commit a98c59a

Please sign in to comment.