Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drop use of code-generator/generate-groups.sh #3136

Merged
merged 3 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/test/example/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ limitations under the License.
*/

// +k8s:deepcopy-gen=package
// +groupName=sample.knative.dev
// +groupName=example.knative.dev
package v1alpha1
2 changes: 1 addition & 1 deletion apis/test/example/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/test/pub/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ limitations under the License.
*/

// +k8s:deepcopy-gen=package
// +groupName=sample.knative.dev
// +groupName=pub.knative.dev
package v1alpha1
2 changes: 1 addition & 1 deletion apis/test/pub/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion hack/generate-knative.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

# generate-groups generates everything for a project with external types only, e.g. a project based
# generate-knative generates everything for a project with external types only, e.g. a project based
# on CustomResourceDefinitions.

if [ "$#" -lt 4 ] || [ "${1}" == "--help" ]; then
Expand Down
8 changes: 0 additions & 8 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,8 @@ set -o pipefail

source $(dirname $0)/../vendor/knative.dev/hack/codegen-library.sh

# If we run with -mod=vendor here, then generate-groups.sh looks for vendor files in the wrong place.
export GOFLAGS=-mod=

echo "=== Update Codegen for $MODULE_NAME"

# 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.

group "Kubernetes Codegen"

# Knative Injection
Expand Down
9 changes: 0 additions & 9 deletions injection/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,6 @@ To make generating stubs simple, we have harnessed the Kubernetes
code-generation tooling to produce `injection-gen`. Similar to how you might
ordinarily run the other `foo-gen` processed:

```shell
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}

${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
github.com/knative/sample-controller/pkg/client github.com/knative/sample-controller/pkg/apis \
"samples:v1alpha1" \
--go-header-file ${REPO_ROOT}/hack/boilerplate/boilerplate.go.txt
```

To run `injection-gen` you run the following (replacing the import path and api
group):

Expand Down
31 changes: 13 additions & 18 deletions test/test-reconciler-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,25 @@ rm -rf $(dirname $0)/genclient

header "Test Generated Reconciler Builds."

chmod +x ${CODEGEN_PKG}/generate-groups.sh
source "${CODEGEN_PKG}/kube_codegen.sh"

${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
${GENCLIENT_PKG} knative.dev/pkg/apis/test \
"example:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
kube::codegen::gen_helpers \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt" \
"${REPO_ROOT_DIR}/apis/test"

kube::codegen::gen_client \
--boilerplate "${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt" \
--output-dir "${REPO_ROOT_DIR}/test/genclient" \
--output-pkg "${GENCLIENT_PKG}" \
--with-watch \
"${REPO_ROOT_DIR}/apis/test"

# Knative Injection
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
${GENCLIENT_PKG} knative.dev/pkg/apis/test \
"example:v1alpha1" \
"example:v1alpha1,pub:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt \
--force-genreconciler-kinds "Foo"

${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
${GENCLIENT_PKG}/pub knative.dev/pkg/apis/test \
"pub:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt

# Knative Injection
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
${GENCLIENT_PKG}/pub knative.dev/pkg/apis/test \
"pub:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
--force-genreconciler-kinds "Foo,Bar"

if ! go build -v $(dirname $0)/genclient/... ; then
exit 1
Expand Down
Loading