293 lines
6.3 KiB
Python
293 lines
6.3 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"
|
|
|
|
JQ = "//hack/bin:jq"
|
|
|
|
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"],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-links",
|
|
srcs = ["verify-links.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 %s)" % JQ,
|
|
"$(location :update-bazel)",
|
|
"$(location :update-deps-licenses)",
|
|
],
|
|
data = [
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
JQ,
|
|
":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 %s)" % JQ,
|
|
"$(location :update-bazel)",
|
|
"$(location :update-deps-licenses)",
|
|
],
|
|
data = [
|
|
":update-deps",
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
JQ,
|
|
":update-bazel",
|
|
":update-deps-licenses",
|
|
"@//:all-srcs",
|
|
],
|
|
tags = ["manual"],
|
|
)
|
|
|
|
sh_binary(
|
|
name = "update-deps-licenses",
|
|
srcs = ["update-deps-licenses.sh"],
|
|
args = [
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % JQ,
|
|
],
|
|
data = [
|
|
GO,
|
|
JQ,
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-deps-licenses",
|
|
srcs = ["verify-deps-licenses.sh"],
|
|
args = [
|
|
"$(location :update-deps-licenses)",
|
|
"$(location %s)" % GO,
|
|
"$(location %s)" % JQ,
|
|
],
|
|
data = [
|
|
GAZELLE,
|
|
GO,
|
|
KAZEL,
|
|
JQ,
|
|
":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,
|
|
"@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",
|
|
],
|
|
)
|
|
|
|
sh_test(
|
|
name = "verify-codegen",
|
|
srcs = ["verify-codegen.sh"],
|
|
args = [
|
|
"$(location :update-codegen)",
|
|
"$(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",
|
|
":update-codegen",
|
|
GO,
|
|
GOROOT,
|
|
GAZELLE,
|
|
KAZEL,
|
|
"@//: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",
|
|
],
|
|
)
|
|
|
|
# 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,
|
|
],
|
|
data = [
|
|
":update-crds",
|
|
GO,
|
|
CONTROLLER_GEN,
|
|
"@//:all-srcs",
|
|
],
|
|
)
|
|
|
|
filegroup(
|
|
name = "package-srcs",
|
|
srcs = glob(["**"]),
|
|
tags = ["automanaged"],
|
|
visibility = ["//visibility:private"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "all-srcs",
|
|
srcs = [
|
|
":package-srcs",
|
|
"//hack/api-migration:all-srcs",
|
|
"//hack/bin:all-srcs",
|
|
"//hack/boilerplate:all-srcs",
|
|
"//hack/build:all-srcs",
|
|
"//hack/release:all-srcs",
|
|
],
|
|
tags = ["automanaged"],
|
|
visibility = ["//visibility:public"],
|
|
)
|