Skip to content

Commit

Permalink
Merge pull request #31 from RainbowMango/pr_fix_update_codegen
Browse files Browse the repository at this point in the history
Fix hack/update-codegen.sh failed to generates the code in right place
  • Loading branch information
k8s-ci-robot committed May 21, 2024
2 parents 77f5c1c + 5f1b1c7 commit 2c2253a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 14 deletions.
41 changes: 30 additions & 11 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,41 @@ if [[ "${VERIFY_CODEGEN:-}" == "true" ]]; then
fi
COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt"

# code generator tools rely on the environment variable GOPATH and generates files to $GOPATH/src/.
export GOPATH=$(go env GOPATH | awk -F ':' '{print $1}')

echo "Generating deepcopy funcs"
"${gobin}/deepcopy-gen" --input-dirs "${FQ_APIS}" -O zz_generated.deepcopy --bounding-dirs "${APIS_PKG}" ${COMMON_FLAGS}
"${gobin}/deepcopy-gen" \
--input-dirs=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-package=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-file-base=zz_generated.deepcopy \
${COMMON_FLAGS}

echo "Generating register at ${FQ_APIS}"
"${gobin}/register-gen" \
--input-dirs=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-package=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-file-base=zz_generated.register \
${COMMON_FLAGS}

echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}"
"${gobin}/client-gen" --clientset-name "${CLIENTSET_NAME}" --input-base "" --input "${FQ_APIS}" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" ${COMMON_FLAGS}
"${gobin}/client-gen" \
--input-base="" \
--input=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-package=sigs.k8s.io/work-api/pkg/client/clientset \
--clientset-name=versioned \
${COMMON_FLAGS}

echo "Generating listers at ${OUTPUT_PKG}/listers"
"${gobin}/lister-gen" --input-dirs "${FQ_APIS}" --output-package "${OUTPUT_PKG}/listers" ${COMMON_FLAGS}
"${gobin}/lister-gen" \
--input-dirs=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--output-package=sigs.k8s.io/work-api/pkg/client/listers \
${COMMON_FLAGS}

echo "Generating informers at ${OUTPUT_PKG}/informers"
"${gobin}/informer-gen" \
--input-dirs "${FQ_APIS}" \
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \
--listers-package "${OUTPUT_PKG}/listers" \
--output-package "${OUTPUT_PKG}/informers" \
${COMMON_FLAGS}

echo "Generating register at ${FQ_APIS}"
"${gobin}/register-gen" --output-package "${FQ_APIS}" --input-dirs ${FQ_APIS} ${COMMON_FLAGS}
--input-dirs=sigs.k8s.io/work-api/pkg/apis/v1alpha1 \
--versioned-clientset-package=sigs.k8s.io/work-api/pkg/client/clientset/versioned \
--listers-package=sigs.k8s.io/work-api/pkg/client/listers \
--output-package=sigs.k8s.io/work-api/pkg/client/informers \
${COMMON_FLAGS}
2 changes: 2 additions & 0 deletions pkg/apis/v1alpha1/appliedwork_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ type AppliedResourceMeta struct {
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,categories={fleet}
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// AppliedWork represents an applied work on managed cluster that is placed
// on a managed cluster. An appliedwork links to a work on a hub recording resources
Expand All @@ -89,6 +90,7 @@ type AppliedWork struct {
}

// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// AppliedWorkList contains a list of AppliedWork
type AppliedWorkList struct {
Expand Down
1 change: 1 addition & 0 deletions pkg/apis/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ limitations under the License.

// Package v1alpha1 contains API schema definitions for the Multi-Cluster
// Services v1alpha1 API group.
// +k8s:deepcopy-gen=package,register
// +kubebuilder:object:generate=true
// +groupName=multicluster.x-k8s.io
package v1alpha1
2 changes: 2 additions & 0 deletions pkg/apis/v1alpha1/work_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ type ManifestCondition struct {

// +genclient
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:subresource:status

// Work is the Schema for the works API
Expand All @@ -116,6 +117,7 @@ type Work struct {
}

// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// WorkList contains a list of Work
type WorkList struct {
Expand Down
19 changes: 16 additions & 3 deletions pkg/apis/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2c2253a

Please sign in to comment.