Skip to content

Commit b9a029d

Browse files
committed
bazel: generate pkg/generated/bindata.go at build time
1 parent aab5cb4 commit b9a029d

File tree

5 files changed

+35
-3
lines changed

5 files changed

+35
-3
lines changed

build/root/BUILD.root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ filegroup(
7070
"//staging:all-srcs",
7171
"//test:all-srcs",
7272
"//third_party:all-srcs",
73+
"//translations:all-srcs",
7374
"//vendor:all-srcs",
7475
],
7576
tags = ["automanaged"],

hack/generate-bindata.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pushd "${KUBE_ROOT}" >/dev/null
4242
# These are files for e2e tests.
4343
BINDATA_OUTPUT="test/e2e/generated/bindata.go"
4444
go-bindata -nometadata -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
45-
-ignore .jpg -ignore .png -ignore .md \
45+
-ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \
4646
"test/e2e/testing-manifests/..." \
4747
"test/images/..." \
4848
"test/fixtures/..."
@@ -64,7 +64,7 @@ rm -f "${BINDATA_OUTPUT}.tmp"
6464
# These are files for runtime code
6565
BINDATA_OUTPUT="pkg/generated/bindata.go"
6666
go-bindata -nometadata -nocompress -o "${BINDATA_OUTPUT}.tmp" -pkg generated \
67-
-ignore .jpg -ignore .png -ignore .md \
67+
-ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \
6868
"translations/..."
6969

7070
gofmt -s -w "${BINDATA_OUTPUT}.tmp"

pkg/generated/BUILD

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ load(
55
"go_library",
66
)
77

8+
genrule(
9+
name = "bindata",
10+
srcs = [
11+
"//translations:all-srcs",
12+
],
13+
outs = ["bindata.go"],
14+
cmd = """
15+
$(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \
16+
-nometadata -nocompress -o "$(OUTS)" -pkg generated \
17+
-prefix $$(pwd) \
18+
-ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \
19+
$(SRCS)
20+
""",
21+
tools = [
22+
"//vendor/github.com/jteeuwen/go-bindata/go-bindata",
23+
],
24+
)
25+
826
go_library(
927
name = "go_default_library",
1028
srcs = [

test/e2e/generated/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ genrule(
3030
$(location //vendor/github.com/jteeuwen/go-bindata/go-bindata:go-bindata) \
3131
-nometadata -o "$(OUTS)" -pkg generated \
3232
-prefix $$(pwd) \
33-
-ignore .jpg -ignore .png -ignore .md \
33+
-ignore .jpg -ignore .png -ignore .md -ignore 'BUILD(\.bazel)?' \
3434
$(SRCS)
3535
""",
3636
tools = [

translations/BUILD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
filegroup(
2+
name = "package-srcs",
3+
srcs = glob(["**"]),
4+
tags = ["automanaged"],
5+
visibility = ["//visibility:private"],
6+
)
7+
8+
filegroup(
9+
name = "all-srcs",
10+
srcs = [":package-srcs"],
11+
tags = ["automanaged"],
12+
visibility = ["//visibility:public"],
13+
)

0 commit comments

Comments
 (0)