Skip to content

Commit 0879707

Browse files
authored
delete vendor && optimize the way to generate apis (volcano-sh#48)
* delete vendor && optimize the way to generate apis Signed-off-by: huone1 <[email protected]> * optimize hack/generate-internal-groups.sh Signed-off-by: huone1 <[email protected]>
1 parent c618349 commit 0879707

File tree

2,274 files changed

+17
-850711
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,274 files changed

+17
-850711
lines changed

vendor/k8s.io/code-generator/generate-groups.sh hack/generate-groups.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,8 @@ APIS_PKG="$3"
4646
GROUPS_WITH_VERSIONS="$4"
4747
shift 4
4848

49-
(
50-
# To support running this script from anywhere, we have to first cd into this directory
51-
# so we can install the tools.
52-
cd "$(dirname "${0}")"
53-
go install ./cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}
54-
)
49+
go get k8s.io/code-generator/cmd/{defaulter-gen,client-gen,lister-gen,informer-gen,deepcopy-gen}@v0.19.6
50+
5551
# Go installs the above commands to get installed in $GOBIN if defined, and $GOPATH/bin otherwise:
5652
GOBIN="$(go env GOBIN)"
5753
gobin="${GOBIN:-$(go env GOPATH)/bin}"

vendor/k8s.io/code-generator/generate-internal-groups.sh hack/generate-internal-groups.sh

+13-9
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ EXT_APIS_PKG="$4"
4747
GROUPS_WITH_VERSIONS="$5"
4848
shift 5
4949

50-
go install --mod=vendor ./"$(dirname "${0}")"/cmd/{defaulter-gen,conversion-gen,client-gen,lister-gen,informer-gen,deepcopy-gen,openapi-gen}
50+
go get k8s.io/code-generator/cmd/{defaulter-gen,conversion-gen,client-gen,lister-gen,informer-gen,deepcopy-gen,openapi-gen}@v0.19.6
51+
52+
# Go installs the above commands to get installed in $GOBIN if defined, and $GOPATH/bin otherwise:
53+
GOBIN="$(go env GOBIN)"
54+
gobin="${GOBIN:-$(go env GOPATH)/bin}"
5155

5256
function codegen::join() { local IFS="$1"; shift; echo "$*"; }
5357

@@ -72,36 +76,36 @@ done
7276

7377
if [ "${GENS}" = "all" ] || grep -qw "deepcopy" <<<"${GENS}"; then
7478
echo "Generating deepcopy funcs"
75-
"${GOROOT}/bin/deepcopy-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${INT_APIS_PKG},${EXT_APIS_PKG}" "$@"
79+
"${gobin}/deepcopy-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.deepcopy --bounding-dirs "${INT_APIS_PKG},${EXT_APIS_PKG}" "$@"
7680
fi
7781

7882
if [ "${GENS}" = "all" ] || grep -qw "defaulter" <<<"${GENS}"; then
7983
echo "Generating defaulters"
80-
"${GOROOT}/bin/defaulter-gen" --input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" -O zz_generated.defaults "$@"
84+
"${gobin}/defaulter-gen" --input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}")" -O zz_generated.defaults "$@"
8185
fi
8286

8387
if [ "${GENS}" = "all" ] || grep -qw "conversion" <<<"${GENS}"; then
8488
echo "Generating conversions"
85-
"${GOROOT}/bin/conversion-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.conversion "$@"
89+
"${gobin}/conversion-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" -O zz_generated.conversion "$@"
8690
fi
8791

8892
if [ "${GENS}" = "all" ] || grep -qw "client" <<<"${GENS}"; then
8993
echo "Generating clientset for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}"
9094
if [ -n "${INT_APIS_PKG}" ]; then
9195
IFS=" " read -r -a APIS <<< "$(printf '%s/ ' "${INT_FQ_APIS[@]}")"
92-
"${GOROOT}/bin/client-gen" --clientset-name "${CLIENTSET_NAME_INTERNAL:-internalversion}" --input-base "" --input "$(codegen::join , "${APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
96+
"${gobin}/client-gen" --clientset-name "${CLIENTSET_NAME_INTERNAL:-internalversion}" --input-base "" --input "$(codegen::join , "${APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
9397
fi
94-
"${GOROOT}/bin/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${EXT_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
98+
"${gobin}/client-gen" --clientset-name "${CLIENTSET_NAME_VERSIONED:-versioned}" --input-base "" --input "$(codegen::join , "${EXT_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}" "$@"
9599
fi
96100

97101
if [ "${GENS}" = "all" ] || grep -qw "lister" <<<"${GENS}"; then
98102
echo "Generating listers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/listers"
99-
"${GOROOT}/bin/lister-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
103+
"${gobin}/lister-gen" --input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" --output-package "${OUTPUT_PKG}/listers" "$@"
100104
fi
101105

102106
if [ "${GENS}" = "all" ] || grep -qw "informer" <<<"${GENS}"; then
103107
echo "Generating informers for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/informers"
104-
"${GOROOT}/bin/informer-gen" \
108+
"${gobin}/informer-gen" \
105109
--input-dirs "$(codegen::join , "${ALL_FQ_APIS[@]}")" \
106110
--versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_VERSIONED:-versioned}" \
107111
--internal-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME:-clientset}/${CLIENTSET_NAME_INTERNAL:-internalversion}" \
@@ -113,7 +117,7 @@ fi
113117
if [ "${GENS}" = "all" ] || grep -qw "openapi" <<<"${GENS}"; then
114118
echo "Generating OpenAPI definitions for ${GROUPS_WITH_VERSIONS} at ${OUTPUT_PKG}/openapi"
115119
declare -a OPENAPI_EXTRA_PACKAGES
116-
"${GOROOT}/bin/openapi-gen" \
120+
"${gobin}/openapi-gen" \
117121
--input-dirs "$(codegen::join , "${EXT_FQ_APIS[@]}" "${OPENAPI_EXTRA_PACKAGES[@]}")" \
118122
--input-dirs "k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime,k8s.io/apimachinery/pkg/version" \
119123
--output-package "${OUTPUT_PKG}/openapi" \

hack/update-codegen.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ SCRIPT_ROOT=$(unset CDPATH && cd $(dirname "${BASH_SOURCE[0]}")/.. && pwd)
2626
# --output-base because this script should also be able to run inside the vendor dir of
2727
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
2828
# instead of the $GOPATH directly. For normal projects this can be dropped.
29-
vendor/k8s.io/code-generator/generate-groups.sh "deepcopy,client,informer,lister" \
29+
bash ${SCRIPT_ROOT}/hack/generate-groups.sh "deepcopy,client,informer,lister" \
3030
volcano.sh/apis/pkg/client volcano.sh/apis/pkg/apis \
3131
"batch:v1alpha1 bus:v1alpha1 scheduling:v1beta1 nodeinfo:v1alpha1" \
3232
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate.go.txt
3333

3434
echo "--------------------"
3535

36-
vendor/k8s.io/code-generator/generate-internal-groups.sh "deepcopy,conversion" \
36+
bash ${SCRIPT_ROOT}/hack/generate-internal-groups.sh "deepcopy,conversion" \
3737
volcano.sh/apis/pkg/apis/ volcano.sh/apis/pkg/apis volcano.sh/apis/pkg/apis \
3838
"scheduling:v1beta1" \
3939
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \

vendor/github.com/PuerkitoBio/purell/.gitignore

-5
This file was deleted.

vendor/github.com/PuerkitoBio/purell/.travis.yml

-12
This file was deleted.

vendor/github.com/PuerkitoBio/purell/LICENSE

-12
This file was deleted.

vendor/github.com/PuerkitoBio/purell/README.md

-188
This file was deleted.

0 commit comments

Comments
 (0)