From 8879aa079a7b6f38d4643ee8ed2c0c66bdf5c7d1 Mon Sep 17 00:00:00 2001 From: Felix Kunde Date: Thu, 22 Feb 2024 16:15:21 +0100 Subject: [PATCH] another hack codegen update --- hack/codegen.go | 5 +++++ hack/tools.go | 19 ------------------- hack/update-codegen.sh | 10 +++++----- pkg/apis/zalando.org/v1/doc.go | 6 ++++++ 4 files changed, 16 insertions(+), 24 deletions(-) create mode 100644 hack/codegen.go delete mode 100644 hack/tools.go create mode 100644 pkg/apis/zalando.org/v1/doc.go diff --git a/hack/codegen.go b/hack/codegen.go new file mode 100644 index 000000000..bb4e9d9b9 --- /dev/null +++ b/hack/codegen.go @@ -0,0 +1,5 @@ +// This package imports things required by build scripts, to force `go mod` to see them as dependencies +// Keep a reference to code-generator so it's not removed by go mod tidy +package hack + +import _ "k8s.io/code-generator" diff --git a/hack/tools.go b/hack/tools.go deleted file mode 100644 index 18432c1b1..000000000 --- a/hack/tools.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build tools - -/* -Copyright 2019 The Kubernetes Authors. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// This package imports things required by build scripts, to force `go mod` to see them as dependencies -package tools - -import _ "k8s.io/code-generator" diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 4ed9e0901..6a9f85ef3 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -4,9 +4,9 @@ set -o errexit set -o nounset set -o pipefail -GENERATED_PACKAGE_ROOT="github.com" +GENERATED_PACKAGE_ROOT="src/github.com" OPERATOR_PACKAGE_ROOT="${GENERATED_PACKAGE_ROOT}/zalando/postgres-operator" -SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. +SCRIPT_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. TARGET_CODE_DIR=${1-${SCRIPT_ROOT}/pkg} CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} @@ -20,7 +20,7 @@ trap "cleanup" EXIT SIGINT kube::codegen::gen_helpers \ --input-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" + --boilerplate "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt" kube::codegen::gen_client \ --with-watch \ @@ -28,7 +28,7 @@ kube::codegen::gen_client \ --input-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \ --output-pkg-root "${OPERATOR_PACKAGE_ROOT}/pkg/generated/client" \ --output-base "$(dirname "${BASH_SOURCE[0]}")/../../../../.." \ - --boilerplate "${SCRIPT_ROOT}/hack/boilerplate.go.txt" + --boilerplate "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt" #bash "${CODEGEN_PKG}/kube_codegen.sh" client,deepcopy,informer,lister \ # "${OPERATOR_PACKAGE_ROOT}/pkg/generated" "${OPERATOR_PACKAGE_ROOT}/pkg/apis" \ @@ -36,6 +36,6 @@ kube::codegen::gen_client \ # --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt \ # -o ./ -cp -r "${OPERATOR_PACKAGE_ROOT}"/pkg/* "${TARGET_CODE_DIR}" +#cp -r "${OPERATOR_PACKAGE_ROOT}"/pkg/* "${TARGET_CODE_DIR}" cleanup diff --git a/pkg/apis/zalando.org/v1/doc.go b/pkg/apis/zalando.org/v1/doc.go new file mode 100644 index 000000000..d037c937c --- /dev/null +++ b/pkg/apis/zalando.org/v1/doc.go @@ -0,0 +1,6 @@ +// Package v1 is the v1 version of the API. +// +k8s:deepcopy-gen=package,register + +// +groupName=zalando.org + +package v1