mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 22:33:34 +00:00
Merge pull request #116283 from thockin/codegen_fix_full_regen
Codegen: fix full (burn it to the ground) regen
This commit is contained in:
commit
4c022ceb2c
@ -131,6 +131,70 @@ function codegen::protobuf() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Deep-copy generation
|
||||
#
|
||||
# Any package that wants deep-copy functions generated must include a
|
||||
# comment-tag in column 0 of one file of the form:
|
||||
# // +k8s:deepcopy-gen=<VALUE>
|
||||
#
|
||||
# The <VALUE> may be one of:
|
||||
# generate: generate deep-copy functions into the package
|
||||
# register: generate deep-copy functions and register them with a
|
||||
# scheme
|
||||
function codegen::deepcopy() {
|
||||
# Build the tool.
|
||||
GO111MODULE=on GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/deepcopy-gen
|
||||
|
||||
# The result file, in each pkg, of deep-copy generation.
|
||||
local output_base="${GENERATED_FILE_PREFIX}deepcopy"
|
||||
|
||||
# The tool used to generate deep copies.
|
||||
local gen_deepcopy_bin
|
||||
gen_deepcopy_bin="$(kube::util::find-binary "deepcopy-gen")"
|
||||
|
||||
# Find all the directories that request deep-copy generation.
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: finding all +k8s:deepcopy-gen tags"
|
||||
fi
|
||||
local tag_dirs=()
|
||||
kube::util::read-array tag_dirs < <( \
|
||||
grep -l --null '+k8s:deepcopy-gen=' "${ALL_K8S_TAG_FILES[@]}" \
|
||||
| xargs -0 -n1 dirname \
|
||||
| sort -u)
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: found ${#tag_dirs[@]} +k8s:deepcopy-gen tagged dirs"
|
||||
fi
|
||||
|
||||
local tag_pkgs=()
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
tag_pkgs+=("${PRJ_SRC_PATH}/$dir")
|
||||
done
|
||||
|
||||
kube::log::status "Generating deepcopy code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running ${gen_deepcopy_bin} for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
kube::log::status "DBG: $dir"
|
||||
done
|
||||
fi
|
||||
|
||||
git_find -z ':(glob)**'/"${output_base}.go" | xargs -0 rm -f
|
||||
|
||||
./hack/run-in-gopath.sh "${gen_deepcopy_bin}" \
|
||||
--v "${KUBE_VERBOSE}" \
|
||||
--logtostderr \
|
||||
-h "${BOILERPLATE_FILENAME}" \
|
||||
-O "${output_base}" \
|
||||
--bounding-dirs "${PRJ_SRC_PATH},k8s.io/api" \
|
||||
$(printf -- " -i %s" "${tag_pkgs[@]}") \
|
||||
"$@"
|
||||
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "Generated deepcopy code"
|
||||
fi
|
||||
}
|
||||
|
||||
# Generates types_swagger_doc_generated file for the given group version.
|
||||
# $1: Name of the group version
|
||||
# $2: Path to the directory where types.go for that group version exists. This
|
||||
@ -263,70 +327,6 @@ function codegen::prerelease() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Deep-copy generation
|
||||
#
|
||||
# Any package that wants deep-copy functions generated must include a
|
||||
# comment-tag in column 0 of one file of the form:
|
||||
# // +k8s:deepcopy-gen=<VALUE>
|
||||
#
|
||||
# The <VALUE> may be one of:
|
||||
# generate: generate deep-copy functions into the package
|
||||
# register: generate deep-copy functions and register them with a
|
||||
# scheme
|
||||
function codegen::deepcopy() {
|
||||
# Build the tool.
|
||||
GO111MODULE=on GOPROXY=off go install \
|
||||
k8s.io/code-generator/cmd/deepcopy-gen
|
||||
|
||||
# The result file, in each pkg, of deep-copy generation.
|
||||
local output_base="${GENERATED_FILE_PREFIX}deepcopy"
|
||||
|
||||
# The tool used to generate deep copies.
|
||||
local gen_deepcopy_bin
|
||||
gen_deepcopy_bin="$(kube::util::find-binary "deepcopy-gen")"
|
||||
|
||||
# Find all the directories that request deep-copy generation.
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: finding all +k8s:deepcopy-gen tags"
|
||||
fi
|
||||
local tag_dirs=()
|
||||
kube::util::read-array tag_dirs < <( \
|
||||
grep -l --null '+k8s:deepcopy-gen=' "${ALL_K8S_TAG_FILES[@]}" \
|
||||
| xargs -0 -n1 dirname \
|
||||
| sort -u)
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: found ${#tag_dirs[@]} +k8s:deepcopy-gen tagged dirs"
|
||||
fi
|
||||
|
||||
local tag_pkgs=()
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
tag_pkgs+=("${PRJ_SRC_PATH}/$dir")
|
||||
done
|
||||
|
||||
kube::log::status "Generating deepcopy code for ${#tag_pkgs[@]} targets"
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "DBG: running ${gen_deepcopy_bin} for:"
|
||||
for dir in "${tag_dirs[@]}"; do
|
||||
kube::log::status "DBG: $dir"
|
||||
done
|
||||
fi
|
||||
|
||||
git_find -z ':(glob)**'/"${output_base}.go" | xargs -0 rm -f
|
||||
|
||||
./hack/run-in-gopath.sh "${gen_deepcopy_bin}" \
|
||||
--v "${KUBE_VERBOSE}" \
|
||||
--logtostderr \
|
||||
-h "${BOILERPLATE_FILENAME}" \
|
||||
-O "${output_base}" \
|
||||
--bounding-dirs "${PRJ_SRC_PATH},k8s.io/api" \
|
||||
$(printf -- " -i %s" "${tag_pkgs[@]}") \
|
||||
"$@"
|
||||
|
||||
if [[ "${DBG_CODEGEN}" == 1 ]]; then
|
||||
kube::log::status "Generated deepcopy code"
|
||||
fi
|
||||
}
|
||||
|
||||
# Defaulter generation
|
||||
#
|
||||
# Any package that wants defaulter functions generated must include a
|
||||
@ -725,10 +725,11 @@ function codegen::applyconfigs() {
|
||||
done
|
||||
fi
|
||||
|
||||
git_grep -l --null \
|
||||
(git_grep -l --null \
|
||||
-e '^// Code generated by applyconfiguration-gen. DO NOT EDIT.$' \
|
||||
-- \
|
||||
':(glob)staging/src/k8s.io/client-go/**/*.go' \
|
||||
|| true) \
|
||||
| xargs -0 rm -f
|
||||
|
||||
"${applyconfigurationgen}" \
|
||||
@ -777,10 +778,11 @@ function codegen::clients() {
|
||||
done
|
||||
fi
|
||||
|
||||
git_grep -l --null \
|
||||
(git_grep -l --null \
|
||||
-e '^// Code generated by client-gen. DO NOT EDIT.$' \
|
||||
-- \
|
||||
':(glob)staging/src/k8s.io/client-go/**/*.go' \
|
||||
|| true) \
|
||||
| xargs -0 rm -f
|
||||
|
||||
"${clientgen}" \
|
||||
@ -820,10 +822,11 @@ function codegen::listers() {
|
||||
done
|
||||
fi
|
||||
|
||||
git_grep -l --null \
|
||||
(git_grep -l --null \
|
||||
-e '^// Code generated by lister-gen. DO NOT EDIT.$' \
|
||||
-- \
|
||||
':(glob)staging/src/k8s.io/client-go/**/*.go' \
|
||||
|| true) \
|
||||
| xargs -0 rm -f
|
||||
|
||||
"${listergen}" \
|
||||
@ -860,10 +863,11 @@ function codegen::informers() {
|
||||
done
|
||||
fi
|
||||
|
||||
git_grep -l --null \
|
||||
(git_grep -l --null \
|
||||
-e '^// Code generated by informer-gen. DO NOT EDIT.$' \
|
||||
-- \
|
||||
':(glob)staging/src/k8s.io/client-go/**/*.go' \
|
||||
|| true) \
|
||||
| xargs -0 rm -f
|
||||
|
||||
"${informergen}" \
|
||||
@ -927,7 +931,7 @@ function codegen::protobindings() {
|
||||
fi
|
||||
|
||||
for api in "${apis[@]}"; do
|
||||
git ls-files -z -cmo --exclude-standard ":(glob)${api}"/'**/api.pb.go' \
|
||||
git_find -z ":(glob)${api}"/'**/api.pb.go' \
|
||||
| xargs -0 rm -f
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user