diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 29b7f8a1..e277f42a 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -8,30 +8,22 @@ set -o errexit set -o nounset set -o pipefail +PROJECT_ROOT="$(dirname "$0")"/.. + # setup virtual GOPATH +# shellcheck disable=SC1091 source "$GARDENER_HACK_DIR"/vgopath-setup.sh CODE_GEN_DIR=$(go list -m -f '{{.Dir}}' k8s.io/code-generator) +# shellcheck disable=SC1091 +source "${CODE_GEN_DIR}/kube_codegen.sh" -# We need to explicitly pass GO111MODULE=off to k8s.io/code-generator as it is significantly slower otherwise, -# see https://github.com/kubernetes/code-generator/issues/100. -export GO111MODULE=off - -rm -f $GOPATH/bin/*-gen - -bash "${CODE_GEN_DIR}/generate-internal-groups.sh" \ - deepcopy,defaulter \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/client \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/apis \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/apis \ - "memoryonechost:v1alpha1" \ - --go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt" +rm -f "$GOPATH/bin/*-gen" -bash "${CODE_GEN_DIR}/generate-internal-groups.sh" \ - conversion \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/client \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/apis \ - github.com/gardener/gardener-extension-os-suse-chost/pkg/apis \ - "memoryonechost:v1alpha1" \ - --extra-peer-dirs=github.com/gardener/gardener-extension-os-suse-chost/pkg/apis/memoryonechost,github.com/gardener/gardener-extension-os-suse-chost/pkg/apis/memoryonechost/v1alpha1,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/conversion,k8s.io/apimachinery/pkg/runtime \ - --go-header-file "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt" +kube::codegen::gen_helpers \ + --boilerplate "${GARDENER_HACK_DIR}/LICENSE_BOILERPLATE.txt" \ + --extra-peer-dir k8s.io/apimachinery/pkg/apis/meta/v1 \ + --extra-peer-dir k8s.io/apimachinery/pkg/conversion \ + --extra-peer-dir k8s.io/component-base/config \ + --extra-peer-dir k8s.io/component-base/config/v1alpha1 \ + "${PROJECT_ROOT}/pkg/apis"