mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-19 00:31:00 +00:00
Make update-bindata be incremental build friendly
This commit is contained in:
parent
17454a04ac
commit
22b7d90034
@ -19,8 +19,7 @@ set -o pipefail
|
||||
set -o nounset
|
||||
|
||||
if [[ -z "${KUBE_ROOT:-}" ]]; then
|
||||
# Relative to test/e2e/generated/
|
||||
KUBE_ROOT="../../../"
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
fi
|
||||
|
||||
source "${KUBE_ROOT}/cluster/lib/logging.sh"
|
||||
@ -37,7 +36,7 @@ if ! which go-bindata &>/dev/null ; then
|
||||
fi
|
||||
|
||||
BINDATA_OUTPUT="${KUBE_ROOT}/test/e2e/generated/bindata.go"
|
||||
go-bindata -nometadata -prefix "${KUBE_ROOT}" -o ${BINDATA_OUTPUT} -pkg generated \
|
||||
go-bindata -nometadata -prefix "${KUBE_ROOT}" -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
|
||||
-ignore .jpg -ignore .png -ignore .md \
|
||||
"${KUBE_ROOT}/examples/..." \
|
||||
"${KUBE_ROOT}/docs/user-guide/..." \
|
||||
@ -45,6 +44,16 @@ go-bindata -nometadata -prefix "${KUBE_ROOT}" -o ${BINDATA_OUTPUT} -pkg generate
|
||||
"${KUBE_ROOT}/test/images/..." \
|
||||
"${KUBE_ROOT}/test/fixtures/..."
|
||||
|
||||
gofmt -s -w ${BINDATA_OUTPUT}
|
||||
gofmt -s -w "${BINDATA_OUTPUT}.tmp"
|
||||
|
||||
V=2 kube::log::info "Generated bindata file : $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
|
||||
# Here we compare and overwrite only if different to avoid updating the
|
||||
# timestamp and triggering a rebuild. The 'cat' redirect trick to preserve file
|
||||
# permissions of the target file.
|
||||
if ! cmp -s "${BINDATA_OUTPUT}.tmp" "${BINDATA_OUTPUT}" ; then
|
||||
cat "${BINDATA_OUTPUT}.tmp" > "${BINDATA_OUTPUT}"
|
||||
V=2 kube::log::info "Generated bindata file : ${BINDATA_OUTPUT} has $(wc -l ${BINDATA_OUTPUT}) lines of lovely automated artifacts"
|
||||
else
|
||||
V=2 kube::log::info "No changes in generated bindata file: ${BINDATA_OUTPUT}"
|
||||
fi
|
||||
|
||||
rm -f "${BINDATA_OUTPUT}.tmp"
|
||||
|
Loading…
Reference in New Issue
Block a user