mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
add boilerplate.generatego.txt and let all code-generators use it
remove YEAR field in boilerplate under staging add Do Not Edit for types_swagger_doc and add apiextensions-apiserver's example in codegen.sh
This commit is contained in:
parent
c6d0726df8
commit
32319d6ef7
16
hack/boilerplate/boilerplate.generatego.txt
Normal file
16
hack/boilerplate/boilerplate.generatego.txt
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
@ -42,7 +42,7 @@ function kube::hack::build_ui() {
|
||||
go-bindata -nocompress -o "${output_file}" -prefix ${PWD} -pkg "${pkg}" "${src}"
|
||||
|
||||
local year=$(date +%Y)
|
||||
cat hack/boilerplate/boilerplate.go.txt | sed "s/YEAR/${year}/" > "${TMP_DATAFILE}"
|
||||
cat hack/boilerplate/boilerplate.generatego.txt > "${TMP_DATAFILE}"
|
||||
echo -e "// generated by hack/build-ui.sh; DO NOT EDIT\n" >> "${TMP_DATAFILE}"
|
||||
cat "${output_file}" >> "${TMP_DATAFILE}"
|
||||
|
||||
|
@ -71,8 +71,7 @@ function kube::protoc::format() {
|
||||
local package=${1}
|
||||
|
||||
# Update boilerplate for the generated file.
|
||||
echo "$(cat hack/boilerplate/boilerplate.go.txt ${package}/api.pb.go)" > ${package}/api.pb.go
|
||||
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${package}/api.pb.go
|
||||
echo "$(cat hack/boilerplate/boilerplate.generatego.txt ${package}/api.pb.go)" > ${package}/api.pb.go
|
||||
|
||||
# Run gofmt to clean up the generated code.
|
||||
kube::golang::verify_go_version
|
||||
|
@ -34,7 +34,7 @@ kube::swagger::gen_types_swagger_doc() {
|
||||
|
||||
echo "Generating swagger type docs for ${group_version} at ${gv_dir}"
|
||||
|
||||
sed 's/YEAR/2016/' hack/boilerplate/boilerplate.go.txt > "$TMPFILE"
|
||||
echo -e "$(cat hack/boilerplate/boilerplate.generatego.txt)\n" > "$TMPFILE"
|
||||
echo "package ${group_version##*/}" >> "$TMPFILE"
|
||||
cat >> "$TMPFILE" <<EOF
|
||||
|
||||
@ -48,7 +48,7 @@ kube::swagger::gen_types_swagger_doc() {
|
||||
//
|
||||
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
|
||||
|
||||
// AUTO-GENERATED FUNCTIONS START HERE
|
||||
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
|
||||
EOF
|
||||
|
||||
go run cmd/genswaggertypedocs/swagger_type_docs.go -s \
|
||||
|
@ -72,7 +72,7 @@ INTERNAL_DIRS_CSV=$(IFS=',';echo "${INTERNAL_DIRS[*]// /,}";IFS=$)
|
||||
# This can be called with one flag, --verify-only, so it works for both the
|
||||
# update- and verify- scripts.
|
||||
${clientgen} --input-base="k8s.io/kubernetes/pkg/apis" --input="${INTERNAL_DIRS_CSV}" "$@"
|
||||
${clientgen} --output-base "${KUBE_ROOT}/vendor" --output-package="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt "$@"
|
||||
${clientgen} --output-base "${KUBE_ROOT}/vendor" --output-package="k8s.io/client-go" --clientset-name="kubernetes" --input-base="k8s.io/kubernetes/vendor/k8s.io/api" --input="${GV_DIRS_CSV}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt "$@"
|
||||
|
||||
listergen_internal_apis=(
|
||||
$(
|
||||
@ -91,7 +91,7 @@ $(
|
||||
)
|
||||
)
|
||||
listergen_external_apis_csv=$(IFS=,; echo "${listergen_external_apis[*]}")
|
||||
${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt "$@"
|
||||
${listergen} --output-base "${KUBE_ROOT}/vendor" --output-package "k8s.io/client-go/listers" --input-dirs "${listergen_external_apis_csv}" --go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt "$@"
|
||||
|
||||
informergen_internal_apis=(
|
||||
$(
|
||||
@ -105,7 +105,7 @@ ${informergen} \
|
||||
--input-dirs "${informergen_internal_apis_csv}" \
|
||||
--internal-clientset-package k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset \
|
||||
--listers-package k8s.io/kubernetes/pkg/client/listers \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt \
|
||||
"$@"
|
||||
|
||||
informergen_external_apis=(
|
||||
@ -125,7 +125,7 @@ ${informergen} \
|
||||
--input-dirs "${informergen_external_apis_csv}" \
|
||||
--versioned-clientset-package k8s.io/client-go/kubernetes \
|
||||
--listers-package k8s.io/client-go/listers \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt \
|
||||
"$@"
|
||||
|
||||
# You may add additional calls of code generators like set-gen above.
|
||||
@ -137,3 +137,4 @@ CODEGEN_PKG=./vendor/k8s.io/code-generator vendor/k8s.io/sample-apiserver/hack/u
|
||||
CODEGEN_PKG=./vendor/k8s.io/code-generator vendor/k8s.io/sample-controller/hack/update-codegen.sh
|
||||
CODEGEN_PKG=./vendor/k8s.io/code-generator vendor/k8s.io/apiextensions-apiserver/hack/update-codegen.sh
|
||||
CODEGEN_PKG=./vendor/k8s.io/code-generator vendor/k8s.io/metrics/hack/update-codegen.sh
|
||||
CODEGEN_PKG=./vendor/k8s.io/code-generator vendor/k8s.io/apiextensions-apiserver/examples/client-go/hack/update-codegen.sh
|
||||
|
@ -54,8 +54,7 @@ PATH="${gogopath}:${PATH}" \
|
||||
--gogo_out=plugins=grpc:${KUBE_KMS_GRPC_ROOT} ${KUBE_KMS_GRPC_ROOT}/service.proto
|
||||
|
||||
# Update boilerplate for the generated file.
|
||||
echo "$(cat hack/boilerplate/boilerplate.go.txt ${KUBE_KMS_GRPC_ROOT}/service.pb.go)" > ${KUBE_KMS_GRPC_ROOT}/service.pb.go
|
||||
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${KUBE_KMS_GRPC_ROOT}/service.pb.go
|
||||
echo "$(cat hack/boilerplate/boilerplate.generatego.txt ${KUBE_KMS_GRPC_ROOT}/service.pb.go)" > ${KUBE_KMS_GRPC_ROOT}/service.pb.go
|
||||
|
||||
# Run gofmt to clean up the generated code.
|
||||
kube::golang::verify_go_version
|
||||
|
@ -94,5 +94,5 @@ PATH="${KUBE_ROOT}/_output/bin:${PATH}" \
|
||||
--proto-import="${KUBE_ROOT}/vendor" \
|
||||
--proto-import="${KUBE_ROOT}/third_party/protobuf" \
|
||||
--packages=$(IFS=, ; echo "${PACKAGES[*]}") \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.go.txt \
|
||||
--go-header-file ${KUBE_ROOT}/hack/boilerplate/boilerplate.generatego.txt \
|
||||
"$@"
|
||||
|
@ -54,8 +54,7 @@ PATH="${gogopath}:${PATH}" \
|
||||
--gogo_out=plugins=grpc:${KUBE_REMOTE_RUNTIME_ROOT} ${KUBE_REMOTE_RUNTIME_ROOT}/api.proto
|
||||
|
||||
# Update boilerplate for the generated file.
|
||||
echo "$(cat hack/boilerplate/boilerplate.go.txt ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go)" > ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
|
||||
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
|
||||
echo "$(cat hack/boilerplate/boilerplate.generatego.txt ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go)" > ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
|
||||
|
||||
# Run gofmt to clean up the generated code.
|
||||
kube::golang::verify_go_version
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
Copyright YEAR The Kubernetes Authors.
|
||||
Copyright The Kubernetes Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
Loading…
Reference in New Issue
Block a user