Skip to content

Commit

Permalink
drop use of code-generator/generate-groups.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
dprotaso committed Jan 16, 2025
1 parent 0c2a238 commit 6f54141
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 32 deletions.
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
21 changes: 11 additions & 10 deletions test/test-reconciler-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ 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" \
Expand All @@ -44,11 +50,6 @@ ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
--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 \
Expand Down

0 comments on commit 6f54141

Please sign in to comment.