From 899127701edefc682d5198c0ca141a35ccc7fd09 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 25 Jul 2014 13:23:23 -0400 Subject: [PATCH 1/2] Build all commands at the same time In Go it's much more efficient to build several commands in the same `go build` because the build has to load most of the dependency tree each time. Roughly 50% on my machine: Together (go1.2 on OS X): real 0m4.049s user 0m8.387s sys 0m2.766s Separate: real 0m13.392s user 0m12.420s sys 0m6.882s --- hack/build-go.sh | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hack/build-go.sh b/hack/build-go.sh index 4b41ec128a9..9f9c7e85cc7 100755 --- a/hack/build-go.sh +++ b/hack/build-go.sh @@ -31,7 +31,4 @@ if [ $# -gt 0 ]; then BINARIES="$@" fi -for b in $BINARIES; do - echo "+++ Building ${b}" - go build "${KUBE_GO_PACKAGE}"/cmd/${b} -done +go build $(for b in $BINARIES; do echo "${KUBE_GO_PACKAGE}"/cmd/${b}; done) \ No newline at end of file From 6f84fc06da4e38fe58d7e798df36779bc7000b16 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Fri, 25 Jul 2014 13:31:20 -0400 Subject: [PATCH 2/2] Remove cmd/ prefix on build-go.sh Update places that depend on it. --- hack/build-go.sh | 4 ++-- hack/integration-test.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hack/build-go.sh b/hack/build-go.sh index 9f9c7e85cc7..892419ce01a 100755 --- a/hack/build-go.sh +++ b/hack/build-go.sh @@ -25,10 +25,10 @@ source $(dirname $0)/config-go.sh cd "${KUBE_TARGET}" -BINARIES="proxy integration apiserver controller-manager kubelet kubecfg" +BINARIES="cmd/proxy cmd/integration cmd/apiserver cmd/controller-manager cmd/kubelet cmd/kubecfg" if [ $# -gt 0 ]; then BINARIES="$@" fi -go build $(for b in $BINARIES; do echo "${KUBE_GO_PACKAGE}"/cmd/${b}; done) \ No newline at end of file +go build $(for b in $BINARIES; do echo "${KUBE_GO_PACKAGE}"/${b}; done) \ No newline at end of file diff --git a/hack/integration-test.sh b/hack/integration-test.sh index 91fa62139d5..a0a796d872e 100755 --- a/hack/integration-test.sh +++ b/hack/integration-test.sh @@ -22,7 +22,7 @@ fi # Stop right away if the build fails set -e -$(dirname $0)/build-go.sh integration +$(dirname $0)/build-go.sh cmd/integration ETCD_DIR=$(mktemp -d -t kube-integration.XXXXXX) trap "rm -rf ${ETCD_DIR}" EXIT