Ver Fonte

Makefile, Dockerfile: Add support for regenerating protocol buffers

Signed-off-by: Euan Harris <euan.harris@docker.com>
Euan Harris há 7 anos atrás
pai
commit
22a24df515
2 ficheiros alterados com 15 adições e 2 exclusões
  1. 4 2
      libnetwork/Dockerfile
  2. 11 0
      libnetwork/Makefile

+ 4 - 2
libnetwork/Dockerfile

@@ -1,12 +1,14 @@
 FROM golang:1.10.2 as dev
 FROM golang:1.10.2 as dev
-RUN apt-get update && apt-get -y install iptables
+RUN apt-get update && apt-get -y install iptables \
+		protobuf-compiler
 
 
 RUN go get github.com/golang/lint/golint \
 RUN go get github.com/golang/lint/golint \
 		golang.org/x/tools/cmd/cover \
 		golang.org/x/tools/cmd/cover \
 		github.com/mattn/goveralls \
 		github.com/mattn/goveralls \
 		github.com/gordonklaus/ineffassign \
 		github.com/gordonklaus/ineffassign \
 		github.com/client9/misspell/cmd/misspell \
 		github.com/client9/misspell/cmd/misspell \
-		honnef.co/go/tools/cmd/gosimple
+		honnef.co/go/tools/cmd/gosimple \
+		github.com/gogo/protobuf/protoc-gen-gogo
 
 
 WORKDIR /go/src/github.com/docker/libnetwork
 WORKDIR /go/src/github.com/docker/libnetwork
 
 

+ 11 - 0
libnetwork/Makefile

@@ -123,3 +123,14 @@ gosimple: ## run gosimple
 
 
 shell: builder
 shell: builder
 	@${docker} ${SHELL}
 	@${docker} ${SHELL}
+
+# Rebuild protocol buffers.
+# These may need to be rebuilt after vendoring updates, so .pb.go files are declared .PHONY so they are always rebuilt.
+PROTO_FILES=$(shell find . -path ./vendor -prune -o -name \*.proto -print)
+PB_FILES=$(PROTO_FILES:.proto=.pb.go)
+
+%.pb.go: %.proto
+	${docker} protoc -I=. -I=/go/src -I=/go/src/github.com/gogo/protobuf -I=/go/src/github.com/gogo/protobuf/protobuf --gogo_out=./ $<
+
+.PHONY: protobuf $(PROTO_FILES)
+protobuf: builder $(PB_FILES)