From 1445e4db32e648277470513213473021ca59010a Mon Sep 17 00:00:00 2001 From: Arnaud Porterie Date: Mon, 4 Jan 2016 18:46:04 -0800 Subject: [PATCH] Enable incremental builds Remove the `-a` build flag and introduce `-i` in order to reuse previously compiled dependencies. Signed-off-by: Arnaud Porterie --- hack/make.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hack/make.sh b/hack/make.sh index c87282b756..8648732bb9 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -140,8 +140,17 @@ LDFLAGS_STATIC='' EXTLDFLAGS_STATIC='-static' # ORIG_BUILDFLAGS is necessary for the cross target which cannot always build # with options like -race. -ORIG_BUILDFLAGS=( -a -tags "autogen netgo static_build sqlite_omit_load_extension $DOCKER_BUILDTAGS" -installsuffix netgo ) +ORIG_BUILDFLAGS=( -tags "autogen netgo static_build sqlite_omit_load_extension $DOCKER_BUILDTAGS" -installsuffix netgo ) # see https://github.com/golang/go/issues/9369#issuecomment-69864440 for why -installsuffix is necessary here + +# When $DOCKER_INCREMENTAL_BINARY is set in the environment, enable incremental +# builds by installing dependent packages to the GOPATH. +REBUILD_FLAG="-a" +if [ "$DOCKER_INCREMENTAL_BINARY" ]; then + REBUILD_FLAG="-i" +fi +ORIG_BUILDFLAGS+=( $REBUILD_FLAG ) + BUILDFLAGS=( $BUILDFLAGS "${ORIG_BUILDFLAGS[@]}" ) # Test timeout. : ${TIMEOUT:=120m}