diff --git a/build/licensing.bzl b/build/licensing.bzl index 947fa0682..a9df14f53 100644 --- a/build/licensing.bzl +++ b/build/licensing.bzl @@ -19,7 +19,7 @@ def licensed_file( # This uses '#' as a way to denote a comment. # This will likely need changing depending on the type of the file being # generated. - license_boilerplate = "//hack/boilerplate:boilerplate.bzl.txt", + license_boilerplate = "//hack/boilerplate:boilerplate.bzl.timestamped.txt", **kwargs, ): native.genrule( diff --git a/hack/boilerplate/BUILD.bazel b/hack/boilerplate/BUILD.bazel index e5d5d3280..37d2c138c 100644 --- a/hack/boilerplate/BUILD.bazel +++ b/hack/boilerplate/BUILD.bazel @@ -13,3 +13,16 @@ filegroup( tags = ["automanaged"], visibility = ["//visibility:public"], ) + +genrule( + name = "boilerplate.bzl.timestamped.txt", + srcs = [":boilerplate.bzl.txt"], + outs = ["boilerplate.bzl.timestamped.txt.out"], + cmd = " ".join([ + "sed", + "s/YEAR/$$(date +\"%Y\")/", + "$(location :boilerplate.bzl.txt)", + "> $@", + ]), + visibility = ["//visibility:public"], +)