-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
chore(codegen): respect GOFLAGS when compiling code-generator #68559
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,65 +18,22 @@ set -o errexit | |
set -o nounset | ||
set -o pipefail | ||
|
||
SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
SCRIPT_BASE=${SCRIPT_ROOT}/../.. | ||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo k8s.io/code-generator)} | ||
|
||
if LANG=C sed --help 2>&1 | grep -q GNU; then | ||
SED="sed" | ||
elif which gsed &>/dev/null; then | ||
SED="gsed" | ||
else | ||
echo "Failed to find GNU sed as sed or gsed. If you are on Mac: brew install gnu-sed." >&2 | ||
exit 1 | ||
fi | ||
|
||
# Register function to be called on EXIT to remove generated binary. | ||
function cleanup { | ||
rm -f "${CLIENTGEN:-}" | ||
rm -f "${listergen:-}" | ||
rm -f "${informergen:-}" | ||
} | ||
trap cleanup EXIT | ||
|
||
echo "Building client-gen" | ||
CLIENTGEN="${PWD}/client-gen" | ||
|
||
go build -o "${CLIENTGEN}" ${CODEGEN_PKG}/cmd/client-gen | ||
|
||
PREFIX=k8s.io/kube-aggregator/pkg/apis | ||
INPUT_BASE="--input-base ${PREFIX}" | ||
INPUT_APIS=( | ||
apiregistration/ | ||
apiregistration/v1beta1 | ||
apiregistration/v1 | ||
) | ||
INPUT="--input ${INPUT_APIS[@]}" | ||
CLIENTSET_PATH="--output-package k8s.io/kube-aggregator/pkg/client/clientset_generated" | ||
|
||
${CLIENTGEN} ${INPUT_BASE} ${INPUT} ${CLIENTSET_PATH} --output-base ${SCRIPT_BASE} | ||
${CLIENTGEN} --clientset-name="clientset" ${INPUT_BASE} --input apiregistration/v1beta1,apiregistration/v1 ${CLIENTSET_PATH} --output-base ${SCRIPT_BASE} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt | ||
|
||
|
||
echo "Building lister-gen" | ||
listergen="${PWD}/lister-gen" | ||
go build -o "${listergen}" ${CODEGEN_PKG}/cmd/lister-gen | ||
|
||
LISTER_INPUT="--input-dirs k8s.io/kube-aggregator/pkg/apis/apiregistration --input-dirs k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1,k8s.io/kube-aggregator/pkg/apis/apiregistration/v1" | ||
LISTER_PATH="--output-package k8s.io/kube-aggregator/pkg/client/listers" | ||
${listergen} ${LISTER_INPUT} ${LISTER_PATH} --output-base ${SCRIPT_BASE} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt | ||
|
||
|
||
echo "Building informer-gen" | ||
informergen="${PWD}/informer-gen" | ||
go build -o "${informergen}" ${CODEGEN_PKG}/cmd/informer-gen | ||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/.. | ||
CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-generator 2>/dev/null || echo ../code-generator)} | ||
|
||
CLIENTSET_NAME_VERSIONED=clientset \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't this the standard package anyway? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. its defaulted to "versioned" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ic. So we need this. |
||
CLIENTSET_PKG_NAME=clientset_generated \ | ||
${CODEGEN_PKG}/generate-groups.sh deepcopy,client,lister,informer \ | ||
k8s.io/kube-aggregator/pkg/client k8s.io/kube-aggregator/pkg/apis \ | ||
"apiregistration:v1beta1,v1" \ | ||
--output-base "$(dirname ${BASH_SOURCE})/../../.." \ | ||
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt | ||
|
||
${informergen} \ | ||
--output-base ${SCRIPT_BASE} \ | ||
--input-dirs k8s.io/kube-aggregator/pkg/apis/apiregistration --input-dirs k8s.io/kube-aggregator/pkg/apis/apiregistration/v1beta1,k8s.io/kube-aggregator/pkg/apis/apiregistration/v1 \ | ||
--versioned-clientset-package k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset \ | ||
--internal-clientset-package k8s.io/kube-aggregator/pkg/client/clientset_generated/internalclientset \ | ||
--listers-package k8s.io/kube-aggregator/pkg/client/listers \ | ||
--output-package k8s.io/kube-aggregator/pkg/client/informers \ | ||
CLIENTSET_NAME_VERSIONED=clientset \ | ||
CLIENTSET_PKG_NAME=clientset_generated \ | ||
CLIENTSET_NAME_INTERNAL=internalclientset \ | ||
${CODEGEN_PKG}/generate-internal-groups.sh deepcopy,client,lister,informer,conversion \ | ||
k8s.io/kube-aggregator/pkg/client k8s.io/kube-aggregator/pkg/apis k8s.io/kube-aggregator/pkg/apis \ | ||
"apiregistration:v1beta1,v1" \ | ||
--output-base "$(dirname ${BASH_SOURCE})/../../.." \ | ||
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt | ||
"$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b/c the generated clientset pkg has a hardcoded "clientset" in its path. but for the aggregator clientset, we have "clientset_generated" instead.