From b9a029db6d6a381083b9185799fb97732f4cb377 Mon Sep 17 00:00:00 2001 From: Jeff Grafton Date: Wed, 11 Apr 2018 15:22:26 -0700 Subject: [PATCH] bazel: generate pkg/generated/bindata.go at build time --- build/root/BUILD.root | 1 + hack/generate-bindata.sh | 4 ++-- pkg/generated/BUILD | 18 ++++++++++++++++++ test/e2e/generated/BUILD | 2 +- translations/BUILD | 13 +++++++++++++ 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 translations/BUILD diff --git a/build/root/BUILD.root b/build/root/BUILD.root index f7a0b34f00560..2de430729aa13 100644 --- a/build/root/BUILD.root +++ b/build/root/BUILD.root @@ -70,6 +70,7 @@ filegroup( "//staging:all-srcs", "//test:all-srcs", "//third_party:all-srcs", + "//translations:all-srcs", "//vendor:all-srcs", ], tags = ["automanaged"], diff --git a/hack/generate-bindata.sh b/hack/generate-bindata.sh index 1f54570dcbf9e..72da6fcffd21e 100755 --- a/hack/generate-bindata.sh +++ b/hack/generate-bindata.sh @@ -42,7 +42,7 @@ pushd "${KUBE_ROOT}" >/dev/null # These are files for e2e tests. BINDATA_OUTPUT="test/e2e/generated/bindata.go" go-bindata -nometadata -o "${BINDATA_OUTPUT}.tmp" -pkg generated \ - -ignore .jpg -ignore .png -ignore .md \ + -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ "test/e2e/testing-manifests/..." \ "test/images/..." \ "test/fixtures/..." @@ -64,7 +64,7 @@ rm -f "${BINDATA_OUTPUT}.tmp" # These are files for runtime code BINDATA_OUTPUT="pkg/generated/bindata.go" go-bindata -nometadata -nocompress -o "${BINDATA_OUTPUT}.tmp" -pkg generated \ - -ignore .jpg -ignore .png -ignore .md \ + -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ "translations/..." gofmt -s -w "${BINDATA_OUTPUT}.tmp" diff --git a/pkg/generated/BUILD b/pkg/generated/BUILD index a5ffe28c12253..c5bee578f5c77 100644 --- a/pkg/generated/BUILD +++ b/pkg/generated/BUILD @@ -5,6 +5,24 @@ load( "go_library", ) +genrule( + name = "bindata", + srcs = [ + "//translations:all-srcs", + ], + outs = ["bindata.go"], + cmd = """ +$(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \ + -nometadata -nocompress -o "$(OUTS)" -pkg generated \ + -prefix $$(pwd) \ + -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ + $(SRCS) +""", + tools = [ + "//vendor/github.com/jteeuwen/go-bindata/go-bindata", + ], +) + go_library( name = "go_default_library", srcs = [ diff --git a/test/e2e/generated/BUILD b/test/e2e/generated/BUILD index 1b92341380708..70faed73e4770 100644 --- a/test/e2e/generated/BUILD +++ b/test/e2e/generated/BUILD @@ -30,7 +30,7 @@ genrule( $(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \ -nometadata -o "$(OUTS)" -pkg generated \ -prefix $$(pwd) \ - -ignore .jpg -ignore .png -ignore .md \ + -ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \ $(SRCS) """, tools = [ diff --git a/translations/BUILD b/translations/BUILD new file mode 100644 index 0000000000000..6df04e38cd754 --- /dev/null +++ b/translations/BUILD @@ -0,0 +1,13 @@ +filegroup( + name = "package-srcs", + srcs = glob(["**"]), + tags = ["automanaged"], + visibility = ["//visibility:private"], +) + +filegroup( + name = "all-srcs", + srcs = [":package-srcs"], + tags = ["automanaged"], + visibility = ["//visibility:public"], +)