1 Star 0 Fork 28

cqpine / Jenkins-x

forked from Gitee 极速下载 / Jenkins-x 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Makefile.codegen 3.05 KB
一键复制 编辑 原始数据 按行查看 历史
CODE_GEN_BIN_NAME := codegen
CODE_GEN_GO_DEPENDENCIES := $(call rwildcard,cmd/codegen/,*.go)
CODE_GEN_BUILDFLAGS :=
ifdef DEBUG
CODE_GEN_BUILDFLAGS := -gcflags "all=-N -l" $(CODE_GEN_BUILDFLAGS)
endif
PEGOMOCK_VERSION := v2.2.0
CLIENTSET_GENERATOR_VERSION := kubernetes-1.11.3
GEN_APIDOCS_VERSION := 9642bd3f4de5
OPENAPI_GEN_VERSION := 36ebc4887cdc
build-codegen: build/$(CODE_GEN_BIN_NAME) ## Build the code generator
build/$(CODE_GEN_BIN_NAME): $(CODE_GEN_GO_DEPENDENCIES)
CGO_ENABLED=$(CGO_ENABLED) $(GO) build $(CODE_GEN_BUILDFLAGS) -o build/$(CODE_GEN_BIN_NAME) cmd/codegen/codegen.go
test-codegen: ## Test the code geneator
CGO_ENABLED=$(CGO_ENABLED) $(GO) test -v -short ./cmd/codegen/...
# Generate go code using generate directives in files and kubernetes code generation
# Anything generated by this target should be checked in
generate: build-codegen install-generate-deps generate-mocks generate-openapi generate-client ## Generate the Go code (crds, mocks, openapi, client)
@$(MAKE) fmt
@echo "Generation complete"
install-generate-deps:
$(GO) get github.com/petergtz/pegomock/...@$(PEGOMOCK_VERSION)
generate-mocks: install-generate-deps go-generate fmt ## Generate the mocks
go-generate:
@echo "Generating Mocks using pegomock"
$(GO) generate ./...
generate-client: codegen-clientset codegen-config fmt ## Generate the client
codegen-clientset: build-codegen ## Generate the k8s types and clients
@echo "Generating Kubernetes Clients for pkg/apis in pkg/client for jenkins.io:v1"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(CLIENTSET_GENERATOR_VERSION) clientset --output-package=pkg/client --input-package=pkg/apis --group-with-version=jenkins.io:v1
codegen-config: build-codegen ## Generate the deepcopy for the config, jenkinsfile, and tekton/syntax packages
./build/$(CODE_GEN_BIN_NAME) --generator-version $(CLIENTSET_GENERATOR_VERSION) clientset --generator deepcopy --output-package=pkg --input-package=pkg --group-with-version=config: --group-with-version=jenkinsfile: --group-with-version=tekton:syntax
# Generated docs are not checked in
generate-docs: build-codegen ## Generate the docs
@echo "Generating HTML docs for Kubernetes Clients"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(GEN_APIDOCS_VERSION) docs
generate-openapi: codegen-openapi fmt
codegen-openapi: build-codegen
@echo "Generating OpenAPI structs for Kubernetes Clients"
./build/$(CODE_GEN_BIN_NAME) --generator-version $(OPENAPI_GEN_VERSION) openapi --output-package=pkg/client --input-package=github.com/jenkins-x/jx/pkg/apis --group-with-version=jenkins.io:v1
stash:
# Making sure repo has no outstanding changes
git stash
# Verifies that generated code is in sync with implementation
verify-generation-complete: stash generate ## Verify the generated code is up to date
$(eval CHANGED = $(shell git ls-files --modified --others --exclude-standard))
@if [ "$(CHANGED)" == "" ]; \
then \
echo "All generated files up to date"; \
else \
echo "Code generation is out of date"; \
echo "$(CHANGED)"; \
git diff; \
exit 1; \
fi
Go
1
https://gitee.com/cqpine/Jenkins-x.git
git@gitee.com:cqpine/Jenkins-x.git
cqpine
Jenkins-x
Jenkins-x
master

搜索帮助