Skip to content

Commit

Permalink
integrate the gopath hacks (openshift-knative#252)
Browse files Browse the repository at this point in the history
Signed-off-by: Arghya Sadhu <arghya88@gmail.com>
  • Loading branch information
arghya88 authored Dec 4, 2020
1 parent b042e4a commit b9fcfcd
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

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

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

KNATIVE_CODEGEN_PKG=${KNATIVE_CODEGEN_PKG:-$(cd ${REPO_ROOT_DIR}; ls -d -1 $(dirname $0)/../vendor/knative.dev/pkg 2>/dev/null || echo ../pkg)}
echo "=== Update Codegen for $MODULE_NAME"

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
Expand All @@ -44,23 +36,22 @@ ${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
"sources:v1alpha1 sources:v1beta1 bindings:v1alpha1 bindings:v1beta1 messaging:v1alpha1 messaging:v1beta1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt

group "Knative Codegen"

# Knative Injection
${KNATIVE_CODEGEN_PKG}/hack/generate-knative.sh "injection" \
"knative.dev/eventing-kafka/pkg/client" "knative.dev/eventing-kafka/pkg/apis" \
"sources:v1alpha1 sources:v1beta1 bindings:v1alpha1 bindings:v1beta1 messaging:v1alpha1 messaging:v1beta1" \
--go-header-file ${REPO_ROOT_DIR}/hack/boilerplate.go.txt


# # 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-kafka/pkg/apis \
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

group "Update deps post-codegen"

# Make sure our dependencies are up-to-date
${REPO_ROOT_DIR}/hack/update-deps.sh

0 comments on commit b9fcfcd

Please sign in to comment.