blob: 9cd94ecd694041ebd514ac64776aeeaaab7d4a3f [file] [log] [blame]
Jan Schär36f3b6d2025-05-20 09:05:12 +00001load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template")
Jan Schär0cbf51a2025-04-23 10:21:17 +00002
Jan Schär36f3b6d2025-05-20 09:05:12 +00003# The copyright and Kubernetes stamp variables change less often than the status
4# file. Instead of stamping these into Go binaries through x_defs, we create a
5# file for each variable and stamp through go:embed. With this indirection, only
6# the expand_template actions are executed each time the status file changes,
7# instead of relinking the Go binaries, which would be more expensive.
8
9expand_template(
10 name = "copyright_line",
11 out = "copyright_line.txt",
12 stamp = 1,
13 stamp_substitutions = {"copyright": "{{STABLE_MONOGON_copyright}}"},
14 template = ["copyright"],
15 visibility = ["//visibility:public"],
16)
17
18kubernetes_vars = [
19 "gitMajor",
20 "gitMinor",
21 "gitVersion",
22 "gitCommit",
23 "gitTreeState",
24 "buildDate",
25]
26
27[
28 expand_template(
29 name = "kubernetes_%s" % var,
30 out = "kubernetes_%s.txt" % var,
31 stamp = 1,
32 stamp_substitutions = {"value": "{{STABLE_KUBERNETES_%s}}" % var},
33 template = ["value"],
34 )
35 for var in kubernetes_vars
36]
37
38filegroup(
39 name = "kubernetes_stamp",
40 srcs = ["kubernetes_%s.txt" % var for var in kubernetes_vars],
Jan Schär0cbf51a2025-04-23 10:21:17 +000041 visibility = ["//visibility:public"],
42)