Use file tags to generate deep-copies

This drives most of the logic of deep-copy generation from tags like:
  // +deepcopy-gen=package
..rather than hardcoded lists of packages.  This will make it possible to
subsequently generate code ONLY for packages that need it *right now*, rather
than all of them always.

Also remove pkgs that really do not need deep-copies (no symbols used
anywhere).
This commit is contained in:
Tim Hockin
2016-06-06 22:46:24 -07:00
parent 4c4c6fc40e
commit 28af54138d
41 changed files with 723 additions and 203 deletions

View File

@@ -48,7 +48,34 @@ ${clientgen} --clientset-name="release_1_4" --input="api/v1,extensions/v1beta1,a
${clientgen} --clientset-name=federation_internalclientset --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/","api/" --included-types-overrides="api/Service" "$@"
${clientgen} --clientset-name=federation_release_1_4 --clientset-path=k8s.io/kubernetes/federation/client/clientset_generated --input="../../federation/apis/federation/v1beta1","api/v1" --included-types-overrides="api/v1/Service" "$@"
${conversiongen} "$@"
${deepcopygen} "$@"
${setgen} "$@"
# You may add additional calls of code generators like set-gen above.
# Generate a list of all files that have a `+k8s:` comment-tag. This will be
# used to derive lists of files/dirs for generation tools.
ALL_K8S_TAG_FILES=$(
grep -l '^// \?+k8s:' $(
find . \
-not \( \
\( \
-path ./vendor -o \
-path ./_output -o \
-path ./.git \
\) -prune \
\) \
-type f -name \*.go \
| sed 's|^./||'
)
)
DEEP_COPY_DIRS=$(
grep -l '+k8s:deepcopy-gen=' ${ALL_K8S_TAG_FILES} \
| xargs dirname \
| sort -u
)
INPUTS=$(
for d in ${DEEP_COPY_DIRS}; do
echo k8s.io/kubernetes/$d
done | paste -sd,
)
${deepcopygen} -i ${INPUTS}