forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubernetes#62151 from thockin/build-cleanup-with-g…
…o-1-10 Automatic merge from submit-queue (batch tested with PRs 62495, 63003, 62829, 62151, 62002). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Build cleanup with go 1.10 Simplify our build/test scripts now that go 1.10 is in play. It has caching that seems to actually work. **Release note**: ```release-note NONE ```
- Loading branch information
Showing
11 changed files
with
189 additions
and
842 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ SHELL := /bin/bash | |
# This rule collects all the generated file sets into a single rule. Other | ||
# rules should depend on this to ensure generated files are rebuilt. | ||
.PHONY: generated_files | ||
generated_files: gen_deepcopy gen_defaulter gen_conversion gen_openapi | ||
generated_files: gen_deepcopy gen_defaulter gen_conversion gen_openapi gen_bindata | ||
|
||
.PHONY: verify_generated_files | ||
verify_generated_files: verify_gen_deepcopy \ | ||
|
@@ -486,110 +486,6 @@ $(DEFAULTER_GEN): | |
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/defaulter-gen | ||
touch $@ | ||
|
||
# | ||
# Open-api generation | ||
# | ||
# Any package that wants open-api functions generated must include a | ||
# comment-tag in column 0 of one file of the form: | ||
# // +k8s:openapi-gen=true | ||
# | ||
# The result file, in each pkg, of open-api generation. | ||
OPENAPI_BASENAME := $(GENERATED_FILE_PREFIX)openapi | ||
OPENAPI_FILENAME := $(OPENAPI_BASENAME).go | ||
OPENAPI_OUTPUT_PKG := pkg/generated/openapi | ||
|
||
# The tool used to generate open apis. | ||
OPENAPI_GEN := $(BIN_DIR)/openapi-gen | ||
|
||
# Find all the directories that request open-api generation. | ||
ifeq ($(DBG_MAKEFILE),1) | ||
$(warning ***** finding all +k8s:openapi-gen tags) | ||
endif | ||
OPENAPI_DIRS := $(shell \ | ||
grep --color=never -l '+k8s:openapi-gen=' $(ALL_K8S_TAG_FILES) \ | ||
| xargs -n1 dirname \ | ||
| LC_ALL=C sort -u \ | ||
) | ||
|
||
OPENAPI_OUTFILE := $(OPENAPI_OUTPUT_PKG)/$(OPENAPI_FILENAME) | ||
|
||
# This rule is the user-friendly entrypoint for openapi generation. | ||
.PHONY: gen_openapi | ||
gen_openapi: $(OPENAPI_OUTFILE) $(OPENAPI_GEN) | ||
|
||
# For each dir in OPENAPI_DIRS, this establishes a dependency between the | ||
# output file and the input files that should trigger a rebuild. | ||
# | ||
# Note that this is a deps-only statement, not a full rule (see below). This | ||
# has to be done in a distinct step because wildcards don't work in static | ||
# pattern rules. | ||
# | ||
# The '$(eval)' is needed because this has a different RHS for each LHS, and | ||
# would otherwise produce results that make can't parse. | ||
# | ||
# We depend on the $(GOFILES_META).stamp to detect when the set of input files | ||
# has changed. This allows us to detect deleted input files. | ||
$(foreach dir, $(OPENAPI_DIRS), $(eval \ | ||
$(OPENAPI_OUTFILE): $(META_DIR)/$(dir)/$(GOFILES_META).stamp \ | ||
$(gofiles__$(dir)) \ | ||
)) | ||
|
||
# How to regenerate open-api code. This emits a single file for all results. | ||
$(OPENAPI_OUTFILE): $(OPENAPI_GEN) $(OPENAPI_GEN) | ||
function run_gen_openapi() { \ | ||
./hack/run-in-gopath.sh $(OPENAPI_GEN) \ | ||
--v $(KUBE_VERBOSE) \ | ||
--logtostderr \ | ||
-i $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(OPENAPI_DIRS)) | sed 's/ /,/g') \ | ||
-p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG) \ | ||
-O $(OPENAPI_BASENAME) \ | ||
"$$@"; \ | ||
}; \ | ||
run_gen_openapi | ||
|
||
# This calculates the dependencies for the generator tool, so we only rebuild | ||
# it when needed. It is PHONY so that it always runs, but it only updates the | ||
# file if the contents have actually changed. We 'sinclude' this later. | ||
.PHONY: $(META_DIR)/$(OPENAPI_GEN).mk | ||
$(META_DIR)/$(OPENAPI_GEN).mk: | ||
mkdir -p $(@D); \ | ||
(echo -n "$(OPENAPI_GEN): "; \ | ||
./hack/run-in-gopath.sh go list \ | ||
-f '{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}' \ | ||
./vendor/k8s.io/code-generator/cmd/openapi-gen \ | ||
| grep --color=never "^$(PRJ_SRC_PATH)/" \ | ||
| xargs ./hack/run-in-gopath.sh go list \ | ||
-f '{{$$d := .Dir}}{{$$d}}{{"\n"}}{{range .GoFiles}}{{$$d}}/{{.}}{{"\n"}}{{end}}' \ | ||
| paste -sd' ' - \ | ||
| sed 's/ / \\=,/g' \ | ||
| tr '=,' '\n\t' \ | ||
| sed "s|$$(pwd -P)/||"; \ | ||
) > [email protected]; \ | ||
if ! cmp -s [email protected] $@; then \ | ||
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \ | ||
echo "DBG: $(OPENAPI_GEN).mk changed"; \ | ||
fi; \ | ||
cat [email protected] > $@; \ | ||
rm -f [email protected]; \ | ||
fi | ||
|
||
# Include dependency info for the generator tool. This will cause the rule of | ||
# the same name to be considered and if it is updated, make will restart. | ||
sinclude $(META_DIR)/$(OPENAPI_GEN).mk | ||
|
||
# How to build the generator tool. The deps for this are defined in | ||
# the $(OPENAPI_GEN).mk, above. | ||
# | ||
# A word on the need to touch: This rule might trigger if, for example, a | ||
# non-Go file was added or deleted from a directory on which this depends. | ||
# This target needs to be reconsidered, but Go realizes it doesn't actually | ||
# have to be rebuilt. In that case, make will forever see the dependency as | ||
# newer than the binary, and try to rebuild it over and over. So we touch it, | ||
# and make is happy. | ||
$(OPENAPI_GEN): | ||
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/openapi-gen | ||
touch $@ | ||
|
||
# | ||
# Conversion generation | ||
# | ||
|
@@ -805,3 +701,168 @@ sinclude $(META_DIR)/$(CONVERSION_GEN).mk | |
$(CONVERSION_GEN): | ||
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/conversion-gen | ||
touch $@ | ||
|
||
# | ||
# Open-api generation | ||
# | ||
# Any package that wants open-api functions generated must include a | ||
# comment-tag in column 0 of one file of the form: | ||
# // +k8s:openapi-gen=true | ||
# | ||
# The result file, in each pkg, of open-api generation. | ||
OPENAPI_BASENAME := $(GENERATED_FILE_PREFIX)openapi | ||
OPENAPI_FILENAME := $(OPENAPI_BASENAME).go | ||
OPENAPI_OUTPUT_PKG := pkg/generated/openapi | ||
|
||
# The tool used to generate open apis. | ||
OPENAPI_GEN := $(BIN_DIR)/openapi-gen | ||
|
||
# Find all the directories that request open-api generation. | ||
ifeq ($(DBG_MAKEFILE),1) | ||
$(warning ***** finding all +k8s:openapi-gen tags) | ||
endif | ||
OPENAPI_DIRS := $(shell \ | ||
grep --color=never -l '+k8s:openapi-gen=' $(ALL_K8S_TAG_FILES) \ | ||
| xargs -n1 dirname \ | ||
| LC_ALL=C sort -u \ | ||
) | ||
|
||
OPENAPI_OUTFILE := $(OPENAPI_OUTPUT_PKG)/$(OPENAPI_FILENAME) | ||
|
||
# This rule is the user-friendly entrypoint for openapi generation. | ||
.PHONY: gen_openapi | ||
gen_openapi: $(OPENAPI_OUTFILE) $(OPENAPI_GEN) | ||
|
||
# For each dir in OPENAPI_DIRS, this establishes a dependency between the | ||
# output file and the input files that should trigger a rebuild. | ||
# | ||
# Note that this is a deps-only statement, not a full rule (see below). This | ||
# has to be done in a distinct step because wildcards don't work in static | ||
# pattern rules. | ||
# | ||
# The '$(eval)' is needed because this has a different RHS for each LHS, and | ||
# would otherwise produce results that make can't parse. | ||
# | ||
# We depend on the $(GOFILES_META).stamp to detect when the set of input files | ||
# has changed. This allows us to detect deleted input files. | ||
$(foreach dir, $(OPENAPI_DIRS), $(eval \ | ||
$(OPENAPI_OUTFILE): $(META_DIR)/$(dir)/$(GOFILES_META).stamp \ | ||
$(gofiles__$(dir)) \ | ||
)) | ||
|
||
# How to regenerate open-api code. This emits a single file for all results. | ||
$(OPENAPI_OUTFILE): $(OPENAPI_GEN) $(OPENAPI_GEN) | ||
function run_gen_openapi() { \ | ||
./hack/run-in-gopath.sh $(OPENAPI_GEN) \ | ||
--v $(KUBE_VERBOSE) \ | ||
--logtostderr \ | ||
-i $$(echo $(addprefix $(PRJ_SRC_PATH)/, $(OPENAPI_DIRS)) | sed 's/ /,/g') \ | ||
-p $(PRJ_SRC_PATH)/$(OPENAPI_OUTPUT_PKG) \ | ||
-O $(OPENAPI_BASENAME) \ | ||
"$$@"; \ | ||
}; \ | ||
run_gen_openapi | ||
|
||
# This calculates the dependencies for the generator tool, so we only rebuild | ||
# it when needed. It is PHONY so that it always runs, but it only updates the | ||
# file if the contents have actually changed. We 'sinclude' this later. | ||
.PHONY: $(META_DIR)/$(OPENAPI_GEN).mk | ||
$(META_DIR)/$(OPENAPI_GEN).mk: | ||
mkdir -p $(@D); \ | ||
(echo -n "$(OPENAPI_GEN): "; \ | ||
./hack/run-in-gopath.sh go list \ | ||
-f '{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}' \ | ||
./vendor/k8s.io/code-generator/cmd/openapi-gen \ | ||
| grep --color=never "^$(PRJ_SRC_PATH)/" \ | ||
| xargs ./hack/run-in-gopath.sh go list \ | ||
-f '{{$$d := .Dir}}{{$$d}}{{"\n"}}{{range .GoFiles}}{{$$d}}/{{.}}{{"\n"}}{{end}}' \ | ||
| paste -sd' ' - \ | ||
| sed 's/ / \\=,/g' \ | ||
| tr '=,' '\n\t' \ | ||
| sed "s|$$(pwd -P)/||"; \ | ||
) > [email protected]; \ | ||
if ! cmp -s [email protected] $@; then \ | ||
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \ | ||
echo "DBG: $(OPENAPI_GEN).mk changed"; \ | ||
fi; \ | ||
cat [email protected] > $@; \ | ||
rm -f [email protected]; \ | ||
fi | ||
|
||
# Include dependency info for the generator tool. This will cause the rule of | ||
# the same name to be considered and if it is updated, make will restart. | ||
sinclude $(META_DIR)/$(OPENAPI_GEN).mk | ||
|
||
# How to build the generator tool. The deps for this are defined in | ||
# the $(OPENAPI_GEN).mk, above. | ||
# | ||
# A word on the need to touch: This rule might trigger if, for example, a | ||
# non-Go file was added or deleted from a directory on which this depends. | ||
# This target needs to be reconsidered, but Go realizes it doesn't actually | ||
# have to be rebuilt. In that case, make will forever see the dependency as | ||
# newer than the binary, and try to rebuild it over and over. So we touch it, | ||
# and make is happy. | ||
$(OPENAPI_GEN): | ||
hack/make-rules/build.sh ./vendor/k8s.io/code-generator/cmd/openapi-gen | ||
touch $@ | ||
|
||
# | ||
# bindata generation | ||
# | ||
|
||
# The tool used to generate bindata files. | ||
BINDATA_GEN := $(BIN_DIR)/go-bindata | ||
|
||
# A wrapper script that generates all bindata files. It is fast enough that we | ||
# don't care. | ||
BINDATA_SCRIPT := hack/generate-bindata.sh | ||
|
||
# This rule is the user-friendly entrypoint for bindata generation. | ||
.PHONY: gen_bindata | ||
gen_bindata: $(BINDATA_GEN) FORCE | ||
./hack/run-in-gopath.sh $(BINDATA_SCRIPT) | ||
|
||
FORCE: | ||
|
||
# This calculates the dependencies for the generator tool, so we only rebuild | ||
# it when needed. It is PHONY so that it always runs, but it only updates the | ||
# file if the contents have actually changed. We 'sinclude' this later. | ||
.PHONY: $(META_DIR)/$(BINDATA_GEN).mk | ||
$(META_DIR)/$(BINDATA_GEN).mk: | ||
mkdir -p $(@D); \ | ||
(echo -n "$(BINDATA_GEN): "; \ | ||
./hack/run-in-gopath.sh go list \ | ||
-f '{{.ImportPath}}{{"\n"}}{{range .Deps}}{{.}}{{"\n"}}{{end}}' \ | ||
./vendor/github.com/jteeuwen/go-bindata/go-bindata \ | ||
| grep --color=never "^$(PRJ_SRC_PATH)/" \ | ||
| xargs ./hack/run-in-gopath.sh go list \ | ||
-f '{{$$d := .Dir}}{{$$d}}{{"\n"}}{{range .GoFiles}}{{$$d}}/{{.}}{{"\n"}}{{end}}' \ | ||
| paste -sd' ' - \ | ||
| sed 's/ / \\=,/g' \ | ||
| tr '=,' '\n\t' \ | ||
| sed "s|$$(pwd -P)/||"; \ | ||
) > [email protected]; \ | ||
if ! cmp -s [email protected] $@; then \ | ||
if [[ "$(DBG_CODEGEN)" == 1 ]]; then \ | ||
echo "DBG: $(BINDATA_GEN).mk changed"; \ | ||
fi; \ | ||
cat [email protected] > $@; \ | ||
rm -f [email protected]; \ | ||
fi | ||
|
||
# Include dependency info for the generator tool. This will cause the rule of | ||
# the same name to be considered and if it is updated, make will restart. | ||
sinclude $(META_DIR)/$(BINDATA_GEN).mk | ||
|
||
# How to build the generator tool. The deps for this are defined in | ||
# the $(BINDATA_GEN).mk, above. | ||
# | ||
# A word on the need to touch: This rule might trigger if, for example, a | ||
# non-Go file was added or deleted from a directory on which this depends. | ||
# This target needs to be reconsidered, but Go realizes it doesn't actually | ||
# have to be rebuilt. In that case, make will forever see the dependency as | ||
# newer than the binary, and try to rebuild it over and over. So we touch it, | ||
# and make is happy. | ||
$(BINDATA_GEN): | ||
hack/make-rules/build.sh ./vendor/github.com/jteeuwen/go-bindata/go-bindata | ||
touch $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.