Integrate the gopath hacks to allow for codegen anywhere. (#398)

This commit is contained in:
Scott Nichols 2021-04-07 06:57:49 -07:00 committed by GitHub
parent bcbf2ed393
commit aa595e359b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 12 deletions

View File

@ -18,22 +18,14 @@ set -o errexit
set -o nounset
set -o pipefail
export GO111MODULE=on
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=
if [ -z "${GOPATH:-}" ]; then
export GOPATH=$(go env GOPATH)
fi
echo "=== Update Codegen for $MODULE_NAME"
source $(dirname $0)/../vendor/knative.dev/hack/library.sh
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)}
KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 ./vendor/knative.dev/pkg 2>/dev/null || echo ../pkg)}
chmod +x ${CODEGEN_PKG}/generate-groups.sh
chmod +x ${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh
group "Kubernetes Codegen"
# generate the code with:
# --output-base because this script should also be able to run inside the vendor dir of
@ -44,11 +36,15 @@ ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
"caching:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
group "Knative Codegen"
# Knative Injection
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
knative.dev/caching/pkg/client knative.dev/caching/pkg/apis \
"caching:v1alpha1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate/boilerplate.go.txt
group "Update deps post-codegen"
# Make sure our dependencies are up-to-date
${REPO_ROOT_DIR}/hack/update-deps.sh