-
hi my genrule(
name = "gen_dyna_ts",
outs = ["gen_dyna_ts.h"],
cmd = """
echo "uint64_t dyna_ts = $$(date '+%s');" > $@
""",
)
cc_library(
name = "dyna_ts",
hdrs = [":gen_dyna_ts"],
copts = ["-std=c++17"],
# data = [":gen_dyna_ts"], # also tried this
) and my build cmd is bazel build //path/to/BUILD_dir:dyna_ts and by cat path/to/gen_dyna_ts.h show that the could that be possible? (though i understand this is not conform to the best practices of bazel). btw: i'm not allow to change the build cmd by using something like thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I replied to your stackoverflow comment: https://stackoverflow.com/questions/79016161/how-can-i-generate-a-file-with-the-time-of-bazel-build-and-include-it-in-build-o/79019453?noredirect=1#comment140539857_79019453 The first thing that comes to mind is if you can delete the file that the genrule outputs ( |
Beta Was this translation helpful? Give feedback.
I replied to your stackoverflow comment: https://stackoverflow.com/questions/79016161/how-can-i-generate-a-file-with-the-time-of-bazel-build-and-include-it-in-build-o/79019453?noredirect=1#comment140539857_79019453
The first thing that comes to mind is if you can delete the file that the genrule outputs (
gen_dyna_ts.h
), then bazel will rerun the genrule with the updated time.