- runs "make update-codegen" - adds codegen verification to make tests - changes hack/(update|verify)-codegen.sh to just call make - removes bazel codegen test so it's not automatically run in CI Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
250 lines
5.0 KiB
Python
250 lines
5.0 KiB
Python
package(default_visibility = ["//visibility:public"])
|
|
|
|
GAZELLE = "@bazel_gazelle//cmd/gazelle"
|
|
|
|
KAZEL = "@io_k8s_repo_infra//cmd/kazel"
|
|
|
|
GO = "@go_sdk//:bin/go"
|
|
|
|
GOROOT = "@go_sdk//:files"
|
|
|
|
GOFMT = "@go_sdk//:bin/gofmt"
|
|
|
|
YQ = "//hack/bin:yq"
|
|
|
|
CONTROLLER_GEN = "@io_k8s_sigs_controller_tools//cmd/controller-gen"
|
|
|
|
# General repo verification targets
|
|
|
|
py_test(
|
|
name = "verify-boilerplate",
|
|
srcs = ["verify_boilerplate.py"],
|
|
data = ["@//:all-srcs"],
|
|
main = "verify_boilerplate.py",
|
|
python_version = "PY3",
|
|
tags = ["lint"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-errexit",
|
|
srcs = ["verify-errexit.sh"],
|
|
data = [
|
|
"@//:all-srcs",
|
|
],
|
|
tags = ["lint"],
|
|
)
|
|
|
|
# Bazel file generation rules
|
|
|
|
sh_binary(
|
|
name = "update-bazel",
|
|
srcs = ["update-bazel.sh"],
|
|
args = [
|
|
"$(location %s)" % GAZELLE,
|
|
"$(location %s)" % KAZEL,
|
|
],
|
|
data = [
|
|
GAZELLE,
|
|
KAZEL,
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-bazel",
|
|
srcs = ["verify-bazel.sh"],
|
|
args = [
|
|
"$(location %s)" % GAZELLE,
|
|
"$(location %s)" % KAZEL,
|
|
],
|
|
data = [
|
|
"@//:all-srcs",
|
|
GAZELLE,
|
|
KAZEL,
|
|
],
|
|
tags = ["lint"],
|
|
)
|
|
|
|
sh_binary(
|
|
name = "update-deps",
|
|
srcs = ["update-deps.sh"],
|
|
args = [
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % GAZELLE,
|
|
"$(location %s)" % KAZEL,
|
|
"$(location :update-bazel)",
|
|
"$(location :update-deps-licenses)",
|
|
],
|
|
data = [
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
":update-bazel",
|
|
":update-deps-licenses",
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-deps",
|
|
srcs = ["verify-deps.sh"],
|
|
args = [
|
|
"$(location :update-deps)",
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % GAZELLE,
|
|
"$(location %s)" % KAZEL,
|
|
"$(location :update-bazel)",
|
|
"$(location :update-deps-licenses)",
|
|
],
|
|
data = [
|
|
":update-deps",
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
":update-bazel",
|
|
":update-deps-licenses",
|
|
"@//:all-srcs",
|
|
],
|
|
tags = ["manual"],
|
|
)
|
|
|
|
sh_binary(
|
|
name = "update-deps-licenses",
|
|
srcs = ["update-deps-licenses.sh"],
|
|
args = [
|
|
"$(location %s)" % GO,
|
|
],
|
|
data = [
|
|
GO,
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-deps-licenses",
|
|
srcs = ["verify-deps-licenses.sh"],
|
|
args = [
|
|
"$(location :update-deps-licenses)",
|
|
"$(location %s)" % GO,
|
|
],
|
|
data = [
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
":update-deps-licenses",
|
|
"@//:all-srcs",
|
|
],
|
|
tags = ["manual"],
|
|
)
|
|
|
|
# Kubernetes codegen rules
|
|
|
|
sh_binary(
|
|
name = "update-codegen",
|
|
srcs = ["update-codegen.sh"],
|
|
args = [
|
|
"$(location %s)" % GO,
|
|
"$(location @io_k8s_code_generator//cmd/client-gen)",
|
|
"$(location @io_k8s_code_generator//cmd/deepcopy-gen)",
|
|
"$(location @io_k8s_code_generator//cmd/informer-gen)",
|
|
"$(location @io_k8s_code_generator//cmd/lister-gen)",
|
|
"$(location @io_k8s_code_generator//cmd/defaulter-gen)",
|
|
"$(location @io_k8s_code_generator//cmd/conversion-gen)",
|
|
"$(location :update-bazel)",
|
|
"$(location %s)" % GAZELLE,
|
|
"$(location %s)" % KAZEL,
|
|
],
|
|
data = [
|
|
":update-bazel",
|
|
GO,
|
|
GOROOT,
|
|
GAZELLE,
|
|
KAZEL,
|
|
"//:go.mod",
|
|
"//:go.sum",
|
|
"//hack/boilerplate:all-srcs",
|
|
"@io_k8s_code_generator//cmd/client-gen",
|
|
"@io_k8s_code_generator//cmd/conversion-gen",
|
|
"@io_k8s_code_generator//cmd/deepcopy-gen",
|
|
"@io_k8s_code_generator//cmd/defaulter-gen",
|
|
"@io_k8s_code_generator//cmd/informer-gen",
|
|
"@io_k8s_code_generator//cmd/lister-gen",
|
|
],
|
|
deps = [
|
|
"@bazel_tools//tools/bash/runfiles",
|
|
],
|
|
)
|
|
|
|
# Gofmt rules
|
|
|
|
sh_binary(
|
|
name = "update-gofmt",
|
|
srcs = ["update-gofmt.sh"],
|
|
args = [
|
|
"$(location %s)" % GOFMT,
|
|
],
|
|
data = [
|
|
GOFMT,
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-gofmt",
|
|
srcs = ["verify-gofmt.sh"],
|
|
args = [
|
|
"$(location %s)" % GOFMT,
|
|
],
|
|
data = [
|
|
GOFMT,
|
|
"@//:all-srcs",
|
|
],
|
|
)
|
|
|
|
sh_binary(
|
|
name = "update-crds",
|
|
srcs = ["update-crds.sh"],
|
|
args = [
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % CONTROLLER_GEN,
|
|
],
|
|
data = [
|
|
GO,
|
|
CONTROLLER_GEN,
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-crds",
|
|
srcs = ["verify-crds.sh"],
|
|
args = [
|
|
"$(location :update-crds)",
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % CONTROLLER_GEN,
|
|
"$(location %s)" % YQ,
|
|
],
|
|
data = [
|
|
":update-crds",
|
|
GO,
|
|
CONTROLLER_GEN,
|
|
YQ,
|
|
"@//:all-srcs",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "package-srcs",
|
|
srcs = glob(["**"]),
|
|
tags = ["automanaged"],
|
|
visibility = ["//visibility:private"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "all-srcs",
|
|
srcs = [
|
|
":package-srcs",
|
|
"//hack/bin:all-srcs",
|
|
"//hack/boilerplate:all-srcs",
|
|
"//hack/build:all-srcs",
|
|
"//hack/extractcrd:all-srcs",
|
|
],
|
|
tags = ["automanaged"],
|
|
visibility = ["//visibility:public"],
|
|
)
|