@@ -13,9 +13,14 @@ $(LOCALBIN):
1313
1414# # Tool Versions
1515CONTROLLER_TOOLS_VERSION  ?= v0.9.2
16+ CODEGEN_VERSION  ?= v0.20.15
1617
1718# # Tool Binaries
1819CONTROLLER_GEN  ?= $(LOCALBIN ) /controller-gen
20+ APPLYCONFIGURATION_GEN  ?= $(LOCALBIN ) /applyconfiguration-gen
21+ CLIENT_GEN  ?= $(LOCALBIN ) /client-gen
22+ LISTER_GEN  ?= $(LOCALBIN ) /lister-gen
23+ INFORMER_GEN  ?= $(LOCALBIN ) /informer-gen
1924
2025#  Reset branch name if this a Travis CI environment
2126ifneq  ($(strip  $(TRAVIS_BRANCH ) ) ,)
@@ -70,12 +75,81 @@ init:
7075verify-tag-name : print-global-variables
7176#  Check for invalid tag name
7277t=${TAG}  &&  [ $$ {# t} -le 128 ] || { echo "Target name $$t has 128 or more chars"; false; }
78+ .PHONY : generate-client # # Generate client packages
79+ generate-client : code-generator
80+ rm -rf pkg/client/clientset/versioned pkg/client/informers/externalversions pkg/client/listers/controller/v1beta1 pkg/client/listers/quotasubtree/v1
81+ #  TODO: add this back when the version of the tool has been updated and supports this executable
82+ # $(APPLYCONFIGURATION_GEN) \ 
83+ #	--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \  
84+ #	--go-header-file="hack/boilerplate/boilerplate.go.txt" \  
85+ #	--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/applyconfiguration" \  
86+ #	--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher" 
87+ $(CLIENT_GEN) \
88+ 	--input="pkg/apis/controller/v1beta1" \
89+ 	--input="pkg/apis/quotaplugins/quotasubtree/v1" \
90+ 	--input-base="github.com/project-codeflare/multi-cluster-app-dispatcher" \
91+ 	--go-header-file="hack/boilerplate/boilerplate.go.txt" \
92+ 	--clientset-name "versioned" \
93+ 	--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset" \
94+ 	--output-base="." 
95+ #  TODO: add the following line back once the tool has been upgraded
96+ # 	--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
97+ $(LISTER_GEN) \
98+ 	--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
99+ 	--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1" \
100+ 	--go-header-file="hack/boilerplate/boilerplate.go.txt" \
101+ 	--output-base="." \
102+ 	--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers" 
103+ #  TODO: add the following line back once the tool has been upgraded
104+ # 	--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
105+ $(INFORMER_GEN) \
106+ 	--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" \
107+ 	--input-dirs="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/quotaplugins/quotasubtree/v1" \
108+ 	--versioned-clientset-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned" \
109+ 	--listers-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers" \
110+ 	--go-header-file="hack/boilerplate/boilerplate.go.txt" \
111+ 	--output-base="." \
112+ 	--output-package="github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers" 
113+ #  TODO: add the following line back once the tool has been upgraded
114+ # 	--trim-path-prefix "github.com/project-codeflare/multi-cluster-app-dispatcher"
115+ #  TODO: remove the following lines once the tool has been upgraded and they are no longer needed.
116+ #  The `mv` and `rm` are necessary as the generators write to the gihub.com/... path.
117+ mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned pkg/client/clientset/versioned
118+ mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/informers/externalversions pkg/client/informers/externalversions
119+ mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers/controller/v1beta1 pkg/client/listers/controller/v1beta1
120+ mv -f github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/listers/quotasubtree/v1 pkg/client/listers/quotasubtree/v1 
121+ rm -rf github.com
73122
74123.PHONY : controller-gen
75124controller-gen : $(CONTROLLER_GEN )  # # Download controller-gen locally if necessary.
76125$(CONTROLLER_GEN ) $(LOCALBIN ) 
77126test  -s $(LOCALBIN ) /controller-gen ||  GOBIN=$(LOCALBIN )  go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION ) 
78127
128+ .PHONY : code-generator
129+ # TODO: add $(APPLYCONFIGURATION_GEN) as a dependency when the tool is supported
130+ code-generator : $(CLIENT_GEN )  $(LISTER_GEN )  $(INFORMER_GEN )  $(CONTROLLER_GEN ) 
131+ 
132+ #  TODO: enable this target once the tools is supported
133+ # .PHONY: applyconfiguration-gen
134+ # applyconfiguration-gen: $(APPLYCONFIGURATION_GEN) 
135+ # $(APPLYCONFIGURATION_GEN): $(LOCALBIN)
136+ # test -s $(LOCALBIN)/applyconfiguration-gen || GOBIN=$(LOCALBIN) go install k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION)
137+ 
138+ .PHONY : client-gen
139+ client-gen : $(CLIENT_GEN ) 
140+ $(CLIENT_GEN ) $(LOCALBIN ) 
141+ test  -s $(LOCALBIN ) /client-gen ||  GOBIN=$(LOCALBIN )  go install k8s.io/code-generator/cmd/client-gen@$(CODEGEN_VERSION ) 
142+ 
143+ .PHONY : lister-gen
144+ lister-gen : $(LISTER_GEN ) 
145+ $(LISTER_GEN ) $(LOCALBIN ) 
146+ test  -s $(LOCALBIN ) /lister-gen ||  GOBIN=$(LOCALBIN )  go install k8s.io/code-generator/cmd/lister-gen@$(CODEGEN_VERSION ) 
147+ 
148+ .PHONY : informer-gen
149+ informer-gen : $(INFORMER_GEN ) 
150+ $(INFORMER_GEN ) $(LOCALBIN ) 
151+ test  -s $(LOCALBIN ) /informer-gen ||  GOBIN=$(LOCALBIN )  go install k8s.io/code-generator/cmd/informer-gen@$(CODEGEN_VERSION ) 
152+ 
79153.PHONY : manifests
80154manifests : controller-gen # # Generate CustomResourceDefinition objects.
81155$(CONTROLLER_GEN )  crd:allowDangerousTypes=true paths=" ./pkg/apis/..." 
0 commit comments