108
108
# Some of the later codegens depend on the results of this, so it needs to come
109
109
# first in the case of regenerating everything.
110
110
function codegen::protobuf() {
111
+ if [[ -n " ${LINT:- } " ]]; then
112
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
113
+ kube::log::status " No linter for protobuf codegen"
114
+ fi
115
+ return
116
+ fi
117
+
111
118
# NOTE: All output from this script needs to be copied back to the calling
112
119
# source tree. This is managed in kube::build::copy_output in build/common.sh.
113
120
# If the output set is changed update that function.
@@ -122,7 +129,7 @@ function codegen::protobuf() {
122
129
| sed ' s|^|k8s.io/kubernetes/|;s|k8s.io/kubernetes/staging/src/||' \
123
130
| sort -u)
124
131
125
- kube::log::status " Generating protobufs for ${# apis[@]} targets"
132
+ kube::log::status " protobufs: ${# apis[@]} targets"
126
133
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
127
134
kube::log::status " DBG: generating protobufs for:"
128
135
for dir in " ${apis[@]} " ; do
@@ -154,6 +161,13 @@ function codegen::protobuf() {
154
161
# register: generate deep-copy functions and register them with a
155
162
# scheme
156
163
function codegen::deepcopy() {
164
+ if [[ -n " ${LINT:- } " ]]; then
165
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
166
+ kube::log::status " No linter for deepcopy codegen"
167
+ fi
168
+ return
169
+ fi
170
+
157
171
# Build the tool.
158
172
GOPROXY=off go install \
159
173
k8s.io/code-generator/cmd/deepcopy-gen
@@ -179,7 +193,7 @@ function codegen::deepcopy() {
179
193
tag_pkgs+=(" ./$dir " )
180
194
done
181
195
182
- kube::log::status " Generating deepcopy code for ${# tag_pkgs[@]} targets"
196
+ kube::log::status " deepcopy: ${# tag_pkgs[@]} targets"
183
197
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
184
198
kube::log::status " DBG: running deepcopy-gen for:"
185
199
for dir in " ${tag_dirs[@]} " ; do
@@ -255,14 +269,21 @@ EOF
255
269
# Some of the later codegens depend on the results of this, so it needs to come
256
270
# first in the case of regenerating everything.
257
271
function codegen::swagger() {
272
+ if [[ -n " ${LINT:- } " ]]; then
273
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
274
+ kube::log::status " No linter for swagger codegen"
275
+ fi
276
+ return
277
+ fi
278
+
258
279
# Build the tool
259
280
GOPROXY=off go install \
260
281
./cmd/genswaggertypedocs
261
282
262
283
local group_versions=()
263
284
IFS=" " read -r -a group_versions <<< " meta/v1 meta/v1beta1 ${KUBE_AVAILABLE_GROUP_VERSIONS}"
264
285
265
- kube::log::status " Generating swagger for ${# group_versions[@]} targets"
286
+ kube::log::status " swagger: ${# group_versions[@]} targets"
266
287
267
288
git_find -z ' :(glob)**/types_swagger_doc_generated.go' | xargs -0 rm -f
268
289
@@ -278,6 +299,13 @@ function codegen::swagger() {
278
299
# comment-tag in column 0 of one file of the form:
279
300
# // +k8s:prerelease-lifecycle-gen=true
280
301
function codegen::prerelease() {
302
+ if [[ -n " ${LINT:- } " ]]; then
303
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
304
+ kube::log::status " No linter for prerelease codegen"
305
+ fi
306
+ return
307
+ fi
308
+
281
309
# Build the tool.
282
310
GOPROXY=off go install \
283
311
k8s.io/code-generator/cmd/prerelease-lifecycle-gen
@@ -303,7 +331,7 @@ function codegen::prerelease() {
303
331
tag_pkgs+=(" ./$dir " )
304
332
done
305
333
306
- kube::log::status " Generating prerelease-lifecycle code for ${# tag_pkgs[@]} targets"
334
+ kube::log::status " prerelease-lifecycle: ${# tag_pkgs[@]} targets"
307
335
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
308
336
kube::log::status " DBG: running prerelease-lifecycle-gen for:"
309
337
for dir in " ${tag_dirs[@]} " ; do
@@ -342,6 +370,13 @@ function codegen::prerelease() {
342
370
# FIELDNAME: any object with a field of this name is a candidate
343
371
# for having a defaulter generated
344
372
function codegen::defaults() {
373
+ if [[ -n " ${LINT:- } " ]]; then
374
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
375
+ kube::log::status " No linter for defaults codegen"
376
+ fi
377
+ return
378
+ fi
379
+
345
380
# Build the tool.
346
381
GOPROXY=off go install \
347
382
k8s.io/code-generator/cmd/defaulter-gen
@@ -367,7 +402,7 @@ function codegen::defaults() {
367
402
tag_pkgs+=(" ./$dir " )
368
403
done
369
404
370
- kube::log::status " Generating defaulter code for ${# tag_pkgs[@]} targets"
405
+ kube::log::status " defaults: ${# tag_pkgs[@]} targets"
371
406
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
372
407
kube::log::status " DBG: running defaulter-gen for:"
373
408
for dir in " ${tag_dirs[@]} " ; do
@@ -443,21 +478,27 @@ function codegen::validation() {
443
478
time
444
479
)
445
480
446
- kube::log::status " Generating validation code for ${# tag_pkgs[@]} targets"
481
+ kube::log::status " validation: ${# tag_pkgs[@]} targets"
447
482
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
448
483
kube::log::status " DBG: running validation-gen for:"
449
484
for dir in " ${tag_dirs[@]} " ; do
450
485
kube::log::status " DBG: $dir "
451
486
done
452
487
fi
453
488
454
- git_find -z ' :(glob)**' /" ${output_file} " | xargs -0 rm -f
489
+ local lint_flag=() # empty arrays expand to no-value (as opposed to "")
490
+ if [[ -n " ${LINT:- } " ]]; then
491
+ lint_flag+=(" --lint" )
492
+ else
493
+ git_find -z ' :(glob)**' /" ${output_file} " | xargs -0 rm -f
494
+ fi
455
495
456
496
validation-gen \
457
497
-v " ${KUBE_VERBOSE} " \
458
498
--go-header-file " ${BOILERPLATE_FILENAME} " \
459
499
--output-file " ${output_file} " \
460
500
$( printf -- " --readonly-pkg %s" " ${readonly_pkgs[@]} " ) \
501
+ " ${lint_flag[@]} " ` # may expand to nothing` \
461
502
" ${tag_pkgs[@]} " \
462
503
" $@ "
463
504
@@ -488,6 +529,13 @@ function codegen::validation() {
488
529
# TODO: it might be better in the long term to make peer-types explicit in the
489
530
# IDL.
490
531
function codegen::conversions() {
532
+ if [[ -n " ${LINT:- } " ]]; then
533
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
534
+ kube::log::status " No linter for conversions codegen"
535
+ fi
536
+ return
537
+ fi
538
+
491
539
# Build the tool.
492
540
GOPROXY=off go install \
493
541
k8s.io/code-generator/cmd/conversion-gen
@@ -519,7 +567,7 @@ function codegen::conversions() {
519
567
k8s.io/api/core/v1
520
568
)
521
569
522
- kube::log::status " Generating conversion code for ${# tag_pkgs[@]} targets"
570
+ kube::log::status " conversion: ${# tag_pkgs[@]} targets"
523
571
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
524
572
kube::log::status " DBG: running conversion-gen for:"
525
573
for dir in " ${tag_dirs[@]} " ; do
@@ -549,6 +597,13 @@ function codegen::conversions() {
549
597
# // +k8s:register-gen=package
550
598
#
551
599
function codegen::register() {
600
+ if [[ -n " ${LINT:- } " ]]; then
601
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
602
+ kube::log::status " No linter for register codegen"
603
+ fi
604
+ return
605
+ fi
606
+
552
607
# Build the tool.
553
608
GOPROXY=off go install \
554
609
k8s.io/code-generator/cmd/register-gen
@@ -574,7 +629,7 @@ function codegen::register() {
574
629
tag_pkgs+=(" ./$dir " )
575
630
done
576
631
577
- kube::log::status " Generating register code for ${# tag_pkgs[@]} targets"
632
+ kube::log::status " register: ${# tag_pkgs[@]} targets"
578
633
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
579
634
kube::log::status " DBG: running register-gen for:"
580
635
for dir in " ${tag_dirs[@]} " ; do
@@ -620,6 +675,13 @@ function k8s_tag_files_except() {
620
675
# comment-tag in column 0 of one file of the form:
621
676
# // +k8s:openapi-gen=true
622
677
function codegen::openapi() {
678
+ if [[ -n " ${LINT:- } " ]]; then
679
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
680
+ kube::log::status " No linter for openapi codegen"
681
+ fi
682
+ return
683
+ fi
684
+
623
685
# Build the tool.
624
686
GOPROXY=off go install \
625
687
k8s.io/kube-openapi/cmd/openapi-gen
@@ -664,7 +726,7 @@ function codegen::openapi() {
664
726
tag_pkgs+=(" ./$dir " )
665
727
done
666
728
667
- kube::log::status " Generating openapi code "
729
+ kube::log::status " openapi: ${ # tag_pkgs[@]} targets "
668
730
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
669
731
kube::log::status " DBG: running openapi-gen for:"
670
732
for dir in " ${tag_dirs[@]} " ; do
@@ -698,6 +760,13 @@ function codegen::openapi() {
698
760
}
699
761
700
762
function codegen::applyconfigs() {
763
+ if [[ -n " ${LINT:- } " ]]; then
764
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
765
+ kube::log::status " No linter for applyconfigs codegen"
766
+ fi
767
+ return
768
+ fi
769
+
701
770
GOPROXY=off go install \
702
771
k8s.io/kubernetes/pkg/generated/openapi/cmd/models-schema \
703
772
k8s.io/code-generator/cmd/applyconfiguration-gen
@@ -710,7 +779,7 @@ function codegen::applyconfigs() {
710
779
| sort -u)
711
780
ext_apis+=(" k8s.io/apimachinery/pkg/apis/meta/v1" )
712
781
713
- kube::log::status " Generating apply-config code for ${# ext_apis[@]} targets"
782
+ kube::log::status " apply-config: ${# ext_apis[@]} targets"
714
783
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
715
784
kube::log::status " DBG: running applyconfiguration-gen for:"
716
785
for api in " ${ext_apis[@]} " ; do
@@ -740,6 +809,13 @@ function codegen::applyconfigs() {
740
809
}
741
810
742
811
function codegen::clients() {
812
+ if [[ -n " ${LINT:- } " ]]; then
813
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
814
+ kube::log::status " No linter for clients codegen"
815
+ fi
816
+ return
817
+ fi
818
+
743
819
GOPROXY=off go install \
744
820
k8s.io/code-generator/cmd/client-gen
745
821
@@ -761,7 +837,7 @@ function codegen::clients() {
761
837
gv_dirs+=(" ${pkg_dir} " )
762
838
done
763
839
764
- kube::log::status " Generating client code for ${# gv_dirs[@]} targets"
840
+ kube::log::status " clients: ${# gv_dirs[@]} targets"
765
841
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
766
842
kube::log::status " DBG: running client-gen for:"
767
843
for dir in " ${gv_dirs[@]} " ; do
@@ -795,6 +871,13 @@ function codegen::clients() {
795
871
}
796
872
797
873
function codegen::listers() {
874
+ if [[ -n " ${LINT:- } " ]]; then
875
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
876
+ kube::log::status " No linter for listers codegen"
877
+ fi
878
+ return
879
+ fi
880
+
798
881
GOPROXY=off go install \
799
882
k8s.io/code-generator/cmd/lister-gen
800
883
@@ -805,7 +888,7 @@ function codegen::listers() {
805
888
| while read -r -d $' \0' F; do dirname " ${F} " ; done \
806
889
| sort -u)
807
890
808
- kube::log::status " Generating lister code for ${# ext_apis[@]} targets"
891
+ kube::log::status " listers: ${# ext_apis[@]} targets"
809
892
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
810
893
kube::log::status " DBG: running lister-gen for:"
811
894
for api in " ${ext_apis[@]} " ; do
@@ -835,6 +918,13 @@ function codegen::listers() {
835
918
}
836
919
837
920
function codegen::informers() {
921
+ if [[ -n " ${LINT:- } " ]]; then
922
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
923
+ kube::log::status " No linter for informers codegen"
924
+ fi
925
+ return
926
+ fi
927
+
838
928
GOPROXY=off go install \
839
929
k8s.io/code-generator/cmd/informer-gen
840
930
@@ -845,7 +935,7 @@ function codegen::informers() {
845
935
| while read -r -d $' \0' F; do dirname " ${F} " ; done \
846
936
| sort -u)
847
937
848
- kube::log::status " Generating informer code for ${# ext_apis[@]} targets"
938
+ kube::log::status " informers: code for ${# ext_apis[@]} targets"
849
939
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
850
940
kube::log::status " DBG: running informer-gen for:"
851
941
for api in " ${ext_apis[@]} " ; do
@@ -884,6 +974,13 @@ function indent() {
884
974
}
885
975
886
976
function codegen::subprojects() {
977
+ if [[ -n " ${LINT:- } " ]]; then
978
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
979
+ kube::log::status " No linter for subprojects codegen"
980
+ fi
981
+ return
982
+ fi
983
+
887
984
# Call generation on sub-projects.
888
985
local subs=(
889
986
staging/src/k8s.io/code-generator/examples
@@ -898,7 +995,7 @@ function codegen::subprojects() {
898
995
local codegen
899
996
codegen=" ${KUBE_ROOT} /staging/src/k8s.io/code-generator"
900
997
for sub in " ${subs[@]} " ; do
901
- kube::log::status " Generating code for subproject ${sub} "
998
+ kube::log::status " subproject ${sub} : "
902
999
pushd " ${sub} " > /dev/null
903
1000
CODEGEN_PKG=" ${codegen} " \
904
1001
UPDATE_API_KNOWN_VIOLATIONS=" ${UPDATE_API_KNOWN_VIOLATIONS} " \
@@ -909,6 +1006,13 @@ function codegen::subprojects() {
909
1006
}
910
1007
911
1008
function codegen::protobindings() {
1009
+ if [[ -n " ${LINT:- } " ]]; then
1010
+ if [[ " ${KUBE_VERBOSE} " -gt 2 ]]; then
1011
+ kube::log::status " No linter for protobindings codegen"
1012
+ fi
1013
+ return
1014
+ fi
1015
+
912
1016
# Each element of this array is a directory containing subdirectories which
913
1017
# eventually contain a file named "api.proto".
914
1018
local apis=(
@@ -929,7 +1033,7 @@ function codegen::protobindings() {
929
1033
" staging/src/k8s.io/externaljwt/apis"
930
1034
)
931
1035
932
- kube::log::status " Generating protobuf bindings for ${# apis[@]} targets"
1036
+ kube::log::status " protobuf bindings: ${# apis[@]} targets"
933
1037
if [[ " ${DBG_CODEGEN} " == 1 ]]; then
934
1038
kube::log::status " DBG: generating protobuf bindings for:"
935
1039
for dir in " ${apis[@]} " ; do
0 commit comments