Skip to content

Commit

Permalink
Migrate to kube_gen (#550)
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Wessendorf <[email protected]>
  • Loading branch information
matzew authored Sep 3, 2024
1 parent 49223dd commit ab6b7bb
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 258 deletions.
27 changes: 11 additions & 16 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ set -o nounset
set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh
source "${CODEGEN_PKG}/kube_codegen.sh"

# If we run with -mod=vendor here, then generate-groups.sh looks for vendor files in the wrong place.
export GOFLAGS=-mod=
Expand All @@ -27,14 +28,16 @@ echo "=== Update Codegen for ${MODULE_NAME}"

group "Kubernetes Codegen"

# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
"knative.dev/eventing-github/pkg/client" "knative.dev/eventing-github/pkg/apis" \
"sources:v1alpha1 bindings:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt
kube::codegen::gen_helpers \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate.go.txt" \
"${REPO_ROOT_DIR}/pkg/apis"

kube::codegen::gen_client \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate.go.txt" \
--output-dir "${REPO_ROOT_DIR}/pkg/client" \
--output-pkg "knative.dev/eventing-github/pkg/client" \
--with-watch \
"${REPO_ROOT_DIR}/pkg/apis"

group "Knative Codegen"

Expand All @@ -44,14 +47,6 @@ ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
"sources:v1alpha1 bindings:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt

group "Deepcopy Gen"

# Depends on generate-groups.sh to install bin/deepcopy-gen
${GOPATH}/bin/deepcopy-gen \
-O zz_generated.deepcopy \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt \
-i knative.dev/eventing-github/pkg/apis \

group "Update deps post-codegen"

# Make sure our dependencies are up-to-date
Expand Down
33 changes: 33 additions & 0 deletions pkg/apis/bindings/v1alpha1/zz_generated.defaults.go

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

33 changes: 33 additions & 0 deletions pkg/apis/sources/v1alpha1/zz_generated.defaults.go

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

45 changes: 0 additions & 45 deletions pkg/client/injection/informers/sources/factory/fake/fake.go

This file was deleted.

56 changes: 0 additions & 56 deletions pkg/client/injection/informers/sources/factory/sourcesfactory.go

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit ab6b7bb

Please sign in to comment.