bazel: generate pkg/generated/bindata.go at build time

pull/8/head
Jeff Grafton 2018-04-11 15:22:26 -07:00
parent aab5cb4c34
commit b9a029db6d
5 changed files with 35 additions and 3 deletions

View File

@ -70,6 +70,7 @@ filegroup(
"//staging:all-srcs",
"//test:all-srcs",
"//third_party:all-srcs",
"//translations:all-srcs",
"//vendor:all-srcs",
],
tags = ["automanaged"],

View File

@ -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"

View File

@ -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 = [

View File

@ -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 = [

13
translations/BUILD Normal file
View File

@ -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"],
)