Skip to content

Commit 56ad639

Browse files
committed
Make builds fail if go2make misbehaves
Rather than an obscure error.
1 parent 50e07c9 commit 56ad639

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

build/root/Makefile.generated_files

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ GO_PKGDEPS_FILE = go-pkgdeps.mk
6161
# Include the Go package dependencies file. This will cause the rule of
6262
# the same name to be considered and if it is updated, make will restart and
6363
# reload the updated deps.
64-
sinclude $(META_DIR)/$(GO_PKGDEPS_FILE)
64+
include $(META_DIR)/$(GO_PKGDEPS_FILE)
6565

6666
# Only build and run go2make on the first pass. If that generates a new
6767
# GO_PKGDEPS_FILE, make will restart the whole process and set MAKE_RESTARTS to
@@ -77,17 +77,23 @@ $(META_DIR)/$(GO_PKGDEPS_FILE): FORCE
7777
fi
7878
KUBE_BUILD_PLATFORMS="" \
7979
hack/make-rules/build.sh hack/make-rules/helpers/go2make
80-
hack/run-in-gopath.sh go2make \
81-
k8s.io/kubernetes/... \
82-
--prune k8s.io/kubernetes/staging \
83-
--prune k8s.io/kubernetes/vendor \
84-
k8s.io/kubernetes/vendor/k8s.io/... \
80+
hack/run-in-gopath.sh go2make \
81+
k8s.io/kubernetes/... \
82+
--prune k8s.io/kubernetes/staging \
83+
--prune k8s.io/kubernetes/vendor \
84+
k8s.io/kubernetes/vendor/k8s.io/... \
8585
> $@.tmp
86-
if ! cmp -s $@.tmp $@; then \
87-
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
88-
echo "DBG: $(GO_PKGDEPS_FILE) changed"; \
89-
fi; \
90-
cat $@.tmp > $@; \
86+
if [[ -s $@.tmp ]]; then \
87+
if ! cmp -s $@.tmp $@; then \
88+
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
89+
echo "DBG: $(GO_PKGDEPS_FILE) changed"; \
90+
fi; \
91+
cat $@.tmp > $@; \
92+
fi \
93+
else \
94+
kube::log::error "go2make produced no results"; \
95+
rm -f $@; \
96+
false; \
9197
fi
9298
rm -f $@.tmp
9399
endif # MAKE_RESTARTS

0 commit comments

Comments
 (0)