Makefile: add debug on generated files

This commit is contained in:
Tim Hockin 2021-01-20 11:51:40 -08:00
parent 8703dc6e1c
commit 1b04d05423

View File

@ -99,6 +99,9 @@ endif
ALL_GO_DIRS := $(shell \
hack/make-rules/helpers/cache_go_dirs.sh $(META_DIR)/all_go_dirs.mk \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(ALL_GO_DIRS) | wc -w) *.go dirs)
endif
# Generate a list of all files that have a `+k8s:` comment-tag. This will be
# used to derive lists of files/dirs for generation tools.
@ -109,7 +112,9 @@ ALL_K8S_TAG_FILES := $(shell \
find $(ALL_GO_DIRS) -maxdepth 1 -type f -name \*.go \
| xargs grep --color=never -l '^// *+k8s:' \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(ALL_K8S_TAG_FILES) | wc -w) +k8s: tagged files)
endif
#
# Code generation logic.
@ -139,6 +144,9 @@ PRERELEASE_LIFECYCLE_DIRS := $(shell
| xargs -n1 dirname \
| LC_ALL=C sort -u \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(PRERELEASE_LIFECYCLE_DIRS) | wc -w) +k8s:prerelease-lifecycle-gen tagged dirs)
endif
PRERELEASE_LIFECYCLE_FILES := $(addsuffix /$(PRERELEASE_LIFECYCLE_FILENAME), $(PRERELEASE_LIFECYCLE_DIRS))
# Reset the list of packages that need generation.
@ -154,13 +162,15 @@ gen_prerelease_lifecycle: $(PRERELEASE_LIFECYCLE_GEN) $(META_DIR)/$(PRERELEASE_L
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
echo "DBG: running $(PRERELEASE_LIFECYCLE_GEN) for $$pkgs"; \
fi; \
N=$$(cat $(META_DIR)/$(PRERELEASE_LIFECYCLE_GEN).todo | wc -l); \
echo "Generating prerelease lifecycle code for $$N targets"; \
./hack/run-in-gopath.sh $(PRERELEASE_LIFECYCLE_GEN) \
--v $(KUBE_VERBOSE) \
--logtostderr \
-i "$$pkgs" \
-O $(PRERELEASE_LIFECYCLE_BASENAME) \
"$$@"; \
fi \
fi
# For each dir in PRERELEASE_LIFECYCLE_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
@ -227,6 +237,9 @@ DEEPCOPY_DIRS := $(shell \
| xargs -n1 dirname \
| LC_ALL=C sort -u \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(DEEPCOPY_DIRS) | wc -w) +k8s:deepcopy-gen tagged dirs)
endif
DEEPCOPY_FILES := $(addsuffix /$(DEEPCOPY_FILENAME), $(DEEPCOPY_DIRS))
# Reset the list of packages that need generation.
@ -242,6 +255,8 @@ gen_deepcopy: $(DEEPCOPY_GEN) $(META_DIR)/$(DEEPCOPY_GEN).todo
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
echo "DBG: running $(DEEPCOPY_GEN) for $$pkgs"; \
fi; \
N=$$(cat $(META_DIR)/$(DEEPCOPY_GEN).todo | wc -l); \
echo "Generating deepcopy code for $$N targets"; \
./hack/run-in-gopath.sh $(DEEPCOPY_GEN) \
--v $(KUBE_VERBOSE) \
--logtostderr \
@ -249,7 +264,7 @@ gen_deepcopy: $(DEEPCOPY_GEN) $(META_DIR)/$(DEEPCOPY_GEN).todo
--bounding-dirs $(PRJ_SRC_PATH),"k8s.io/api" \
-O $(DEEPCOPY_BASENAME) \
"$$@"; \
fi \
fi
# For each dir in DEEPCOPY_DIRS, this establishes a dependency between the
# output file and the input files that should trigger a rebuild.
@ -322,6 +337,9 @@ DEFAULTER_DIRS := $(shell \
| xargs -n1 dirname \
| LC_ALL=C sort -u \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(DEFAULTER_DIRS) | wc -w) +k8s:defaulter-gen tagged dirs)
endif
DEFAULTER_FILES := $(addsuffix /$(DEFAULTER_FILENAME), $(DEFAULTER_DIRS))
DEFAULTER_EXTRA_PEER_PKGS := \
$(addprefix $(PRJ_SRC_PATH)/, $(DEFAULTER_DIRS))
@ -339,6 +357,8 @@ gen_defaulter: $(DEFAULTER_GEN) $(META_DIR)/$(DEFAULTER_GEN).todo
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
echo "DBG: running $(DEFAULTER_GEN) for $$pkgs"; \
fi; \
N=$$(cat $(META_DIR)/$(DEFAULTER_GEN).todo | wc -l); \
echo "Generating defaulter code for $$N targets"; \
./hack/run-in-gopath.sh $(DEFAULTER_GEN) \
--v $(KUBE_VERBOSE) \
--logtostderr \
@ -426,6 +446,9 @@ CONVERSION_DIRS := $(shell \
| xargs -n1 dirname \
| LC_ALL=C sort -u \
)
ifeq ($(DBG_MAKEFILE),1)
$(warning ***** found $(shell echo $(CONVERSION_DIRS) | wc -w) +k8s:conversion-gen tagged dirs)
endif
CONVERSION_FILES := $(addsuffix /$(CONVERSION_FILENAME), $(CONVERSION_DIRS))
CONVERSION_EXTRA_PEER_PKGS := \
k8s.io/kubernetes/pkg/apis/core \
@ -446,6 +469,8 @@ gen_conversion: $(CONVERSION_GEN) $(META_DIR)/$(CONVERSION_GEN).todo
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \
echo "DBG: running $(CONVERSION_GEN) for $$pkgs"; \
fi; \
N=$$(cat $(META_DIR)/$(CONVERSION_GEN).todo | wc -l); \
echo "Generating conversion code for $$N targets"; \
./hack/run-in-gopath.sh $(CONVERSION_GEN) \
--extra-peer-dirs $$(echo $(CONVERSION_EXTRA_PEER_PKGS) | sed 's/ /,/g') \
--extra-dirs $$(echo $(CONVERSION_EXTRA_PKGS) | sed 's/ /,/g') \
@ -541,6 +566,9 @@ $(prefix)_OPENAPI_DIRS := $(shell \
| xargs -n1 dirname \
| LC_ALL=C sort -u \
)
ifeq ($(DBG_MAKEFILE),1)
$$(warning ***** found $(shell echo $($(prefix)_OPENAPI_TAG_FILES) | wc -w) +k8s:openapi-gen tagged dirs for $(prefix))
endif
endef
$(foreach prefix, $(OPENAPI_TARGETS), $(eval $(OPENAPI_DIR_DEF)))
@ -579,6 +607,7 @@ endif
# checked-in violation file, and prints error message to request developer to
# fix either the API source code, or the known API rule violation file.
$$($(prefix)_OPENAPI_OUTFILE): $(OPENAPI_GEN) $($(prefix)_KNOWN_VIOLATION_FILENAME)
echo "Generating openapi code for $(prefix)"; \
./hack/run-in-gopath.sh $(OPENAPI_GEN) \
--v $(KUBE_VERBOSE) \
--logtostderr \