Skip to content

Commit

Permalink
Updates code-gen Makefile targets
Browse files Browse the repository at this point in the history
Before running the conversion-gen, we delete the existing generated
files to ensure clean generation of API conversion code.

Signed-off-by: Sagar Muchhal <[email protected]>
Co-authored-by: Vince Prignano <[email protected]>
  • Loading branch information
srm09 and vincepri committed Oct 15, 2020
1 parent 0376515 commit 60369d5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ generate-go-core: $(CONTROLLER_GEN) $(CONVERSION_GEN)
paths=./$(EXP_DIR)/api/... \
paths=./$(EXP_DIR)/addons/api/... \
paths=./cmd/clusterctl/...
$(MAKE) clean-generated-conversions SRC_DIRS="./api/v1alpha3,./$(EXP_DIR)/api/v1alpha3,./$(EXP_DIR)/addons/api/v1alpha3"
$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha3 \
--input-dirs=./$(EXP_DIR)/api/v1alpha3 \
Expand All @@ -245,6 +246,7 @@ generate-go-kubeadm-bootstrap: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go re
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
paths=./bootstrap/kubeadm/api/... \
paths=./bootstrap/kubeadm/types/...
$(MAKE) clean-generated-conversions SRC_DIRS="./bootstrap/kubeadm/api"
$(CONVERSION_GEN) \
--input-dirs=./bootstrap/kubeadm/api/v1alpha3 \
--build-tag=ignore_autogenerated_kubeadm_bootstrap_v1alpha3 \
Expand All @@ -257,6 +259,7 @@ generate-go-kubeadm-control-plane: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs G
$(CONTROLLER_GEN) \
object:headerFile=./hack/boilerplate/boilerplate.generatego.txt \
paths=./controlplane/kubeadm/api/...
$(MAKE) clean-generated-conversions SRC_DIRS="./controlplane/kubeadm/api"
$(CONVERSION_GEN) \
--input-dirs=./controlplane/kubeadm/api/v1alpha3 \
--build-tag=ignore_autogenerated_kubeadm_controlplane_v1alpha3 \
Expand Down Expand Up @@ -624,3 +627,6 @@ diagrams: ## Build proposal diagrams
serve-book: ## Build and serve the book with live-reloading enabled
$(MAKE) -C docs/book serve

.PHONY: clean-generated-conversions
clean-generated-conversions: ## Remove files generated by conversion-gen from the mentioned dirs
(IFS=','; for i in $(SRC_DIRS); do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done)
1 change: 1 addition & 0 deletions test/infrastructure/docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ generate-go: $(CONTROLLER_GEN) $(CONVERSION_GEN) ## Runs Go related generate tar
object:headerFile=$(ROOT)/hack/boilerplate/boilerplate.generatego.txt \
paths=./api/... \
paths=./$(EXP_DIR)/api/...
(IFS=','; for i in "./api/v1alpha3,./$(EXP_DIR)/api/v1alpha3"; do find $$i -type f -name 'zz_generated.conversion*' -exec rm -f {} \;; done)
$(CONVERSION_GEN) \
--input-dirs=./api/v1alpha3 \
--input-dirs=./$(EXP_DIR)/api/v1alpha3 \
Expand Down

0 comments on commit 60369d5

Please sign in to comment.