This repository has been archived by the owner on May 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 382
Add some dependency logic around generators. #1966
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -143,42 +143,26 @@ $(BINDIR)/service-catalog: .init .generate_files cmd/service-catalog | |
|
||
# This section contains the code generation stuff | ||
################################################# | ||
.generate_exes: $(BINDIR)/defaulter-gen \ | ||
$(BINDIR)/deepcopy-gen \ | ||
$(BINDIR)/conversion-gen \ | ||
$(BINDIR)/client-gen \ | ||
$(BINDIR)/lister-gen \ | ||
$(BINDIR)/informer-gen \ | ||
$(BINDIR)/openapi-gen | ||
touch $@ | ||
|
||
$(BINDIR)/defaulter-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/defaulter-gen | ||
|
||
$(BINDIR)/deepcopy-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/deepcopy-gen | ||
|
||
$(BINDIR)/conversion-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/conversion-gen | ||
|
||
$(BINDIR)/client-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/client-gen | ||
GENERATORS = $(addprefix $(BINDIR)/, defaulter-gen deepcopy-gen conversion-gen \ | ||
client-gen lister-gen informer-gen openapi-gen) | ||
|
||
$(BINDIR)/lister-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/lister-gen | ||
.PHONY: generators | ||
generators: $(GENERATORS) | ||
|
||
$(BINDIR)/informer-gen: .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/informer-gen | ||
.SECONDEXPANSION: | ||
|
||
$(BINDIR)/openapi-gen: vendor/k8s.io/code-generator/cmd/openapi-gen | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/$^ | ||
# We specify broad dependencies for these generator binaries: each one depends | ||
# on everything under its source tree as well as gengo's. This uses GNU Make's | ||
# secondary expansion feature to pass $* to `find`. | ||
$(BINDIR)/%-gen: $$(shell find vendor/k8s.io/code-generator/cmd/$$*-gen vendor/k8s.io/gengo) .init | ||
$(DOCKER_CMD) go build -o $@ $(SC_PKG)/vendor/k8s.io/code-generator/cmd/$*-gen | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice comment. this is neat. I'm wondering if the find is the right practice vs having golang handle it vs handling it like upstream k/k does with the go2mk generator. |
||
|
||
.PHONY: $(BINDIR)/e2e.test | ||
$(BINDIR)/e2e.test: .init | ||
$(DOCKER_CMD) go test -c -o $@ $(SC_PKG)/test/e2e | ||
|
||
# Regenerate all files if the gen exes changed or any "types.go" files changed | ||
.generate_files: .init .generate_exes $(TYPES_FILES) | ||
.generate_files: .init generators $(TYPES_FILES) | ||
# generate apiserver deps | ||
$(DOCKER_CMD) $(BUILD_DIR)/update-apiserver-gen.sh | ||
# generate all pkg/client contents | ||
|
@@ -235,10 +219,10 @@ verify-docs: .init docs | |
@echo Running href checker$(SKIP_COMMENT): | ||
@$(DOCKER_CMD) verify-links.sh -s .pkg -s .bundler -s _plugins -s _includes -t $(SKIP_HTTP) . | ||
|
||
verify-generated: .init .generate_exes | ||
verify-generated: .init generators | ||
$(DOCKER_CMD) $(BUILD_DIR)/update-apiserver-gen.sh --verify-only | ||
|
||
verify-client-gen: .init .generate_exes | ||
verify-client-gen: .init generators | ||
$(DOCKER_CMD) $(BUILD_DIR)/verify-client-gen.sh | ||
|
||
format: .init | ||
|
@@ -291,7 +275,6 @@ clean: clean-bin clean-build-image clean-generated clean-coverage | |
|
||
clean-bin: .init $(scBuildImageTarget) | ||
$(DOCKER_CMD) rm -rf $(BINDIR) | ||
rm -f .generate_exes | ||
|
||
clean-build-image: .init $(scBuildImageTarget) | ||
$(DOCKER_CMD) rm -rf .pkg | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this target for? not used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly a convenience, to be able to say "make generators" from the command line. But I've taken your suggestion to reference it throughout instead of $(GENERATORS).