mirror of https://github.com/k3s-io/k3s
Use gazelle and kazel together to manage BUILD files
parent
7717c0bbe6
commit
cce84c3e19
|
@ -4,6 +4,5 @@
|
|||
"^_.*"
|
||||
],
|
||||
"AddSourcesRules": true,
|
||||
"VendorMultipleBuildFiles": true,
|
||||
"K8sOpenAPIGen": true
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
# gazelle:exclude _artifacts
|
||||
# gazelle:exclude _gopath
|
||||
# gazelle:exclude _output
|
||||
# gazelle:exclude _tmp
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
licenses(["notice"])
|
||||
|
|
|
@ -7,9 +7,9 @@ http_archive(
|
|||
|
||||
http_archive(
|
||||
name = "io_kubernetes_build",
|
||||
sha256 = "232fec0ffcb53df5e87fc036ae3e966ea32122fc89ead4c32581b3255c1ab7d0",
|
||||
strip_prefix = "repo-infra-f521b5d472e00e05da5394994942064510a6e8bf",
|
||||
urls = ["https://github.com/kubernetes/repo-infra/archive/f521b5d472e00e05da5394994942064510a6e8bf.tar.gz"],
|
||||
sha256 = "5ba54d17d582ec099ba65d4e409e318e209216b15be819c922a5baae3f4d4283",
|
||||
strip_prefix = "repo-infra-e9d1a126ef355ff5d38e20612c889b07728225a4",
|
||||
urls = ["https://github.com/kubernetes/repo-infra/archive/e9d1a126ef355ff5d38e20612c889b07728225a4.tar.gz"],
|
||||
)
|
||||
|
||||
ETCD_VERSION = "3.0.17"
|
||||
|
|
|
@ -24,6 +24,9 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
||||
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
||||
|
||||
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel d651a70c51ec9a450135ff08ea045d857a6be014
|
||||
# The git commit sha1s here should match the values in $KUBE_ROOT/WORKSPACE.
|
||||
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel e9d1a126ef355ff5d38e20612c889b07728225a4
|
||||
kube::util::go_install_from_commit github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle 82483596ec203eb9c1849937636f4cbed83733eb
|
||||
|
||||
gazelle fix -build_file_name=BUILD,BUILD.bazel -external=vendored -mode=fix -repo_root="$(kube::realpath ${KUBE_ROOT})"
|
||||
kazel -root="$(kube::realpath ${KUBE_ROOT})"
|
||||
|
|
|
@ -24,9 +24,16 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
|
|||
# TODO(spxtr): Remove this line once Bazel is the only way to build.
|
||||
rm -f "${KUBE_ROOT}/pkg/generated/openapi/zz_generated.openapi.go"
|
||||
|
||||
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel d651a70c51ec9a450135ff08ea045d857a6be014
|
||||
# The git commit sha1s here should match the values in $KUBE_ROOT/WORKSPACE.
|
||||
kube::util::go_install_from_commit github.com/kubernetes/repo-infra/kazel e9d1a126ef355ff5d38e20612c889b07728225a4
|
||||
kube::util::go_install_from_commit github.com/bazelbuild/rules_go/go/tools/gazelle/gazelle 82483596ec203eb9c1849937636f4cbed83733eb
|
||||
|
||||
if ! kazel -validate -print-diff -root="$(kube::realpath ${KUBE_ROOT})" ; then
|
||||
gazelle_diff=$(gazelle fix -build_file_name=BUILD,BUILD.bazel -external=vendored -mode=diff -repo_root="$(kube::realpath ${KUBE_ROOT})")
|
||||
kazel_diff=$(kazel -dry-run -print-diff -root="$(kube::realpath ${KUBE_ROOT})")
|
||||
|
||||
if [[ -n "${gazelle_diff}" || -n "${kazel_diff}" ]]; then
|
||||
echo "${gazelle_diff}"
|
||||
echo "${kazel_diff}"
|
||||
echo
|
||||
echo "Run ./hack/update-bazel.sh"
|
||||
exit 1
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
# doc.go is managed by kazel, so gazelle should ignore it.
|
||||
# gazelle:exclude doc.go
|
||||
|
||||
package(default_visibility = ["//visibility:public"])
|
||||
|
||||
load("//pkg/generated/openapi:def.bzl", "openapi_library")
|
||||
|
|
Loading…
Reference in New Issue