| Jan Schär | 36f3b6d | 2025-05-20 09:05:12 +0000 | [diff] [blame^] | 1 | load("@aspect_bazel_lib//lib:expand_template.bzl", "expand_template") |
| Jan Schär | 0cbf51a | 2025-04-23 10:21:17 +0000 | [diff] [blame] | 2 | |
| Jan Schär | 36f3b6d | 2025-05-20 09:05:12 +0000 | [diff] [blame^] | 3 | # 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 | |
| 9 | expand_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 | |
| 18 | kubernetes_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 | |
| 38 | filegroup( |
| 39 | name = "kubernetes_stamp", |
| 40 | srcs = ["kubernetes_%s.txt" % var for var in kubernetes_vars], |
| Jan Schär | 0cbf51a | 2025-04-23 10:21:17 +0000 | [diff] [blame] | 41 | visibility = ["//visibility:public"], |
| 42 | ) |