Makefile, Dockerfile: Add support for regenerating protocol buffers

Signed-off-by: Euan Harris <euan.harris@docker.com>
This commit is contained in:
Euan Harris 2018-06-20 17:20:49 +01:00
parent 6716626d32
commit 22a24df515
2 changed files with 15 additions and 2 deletions

View File

@ -1,12 +1,14 @@
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 \
golang.org/x/tools/cmd/cover \
github.com/mattn/goveralls \
github.com/gordonklaus/ineffassign \
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

View File

@ -123,3 +123,14 @@ gosimple: ## run gosimple
shell: builder
@${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)