1*d4726bddSHONG Yifanload("@rules_rust//rust:defs.bzl", "rust_binary") 2*d4726bddSHONG Yifan 3*d4726bddSHONG Yifanpackage(default_visibility = ["//visibility:public"]) 4*d4726bddSHONG Yifan 5*d4726bddSHONG Yifanrust_binary( 6*d4726bddSHONG Yifan name = "version_reporter", 7*d4726bddSHONG Yifan srcs = ["src/main.rs"], 8*d4726bddSHONG Yifan rustc_env_files = [":generate_rustc_env_file"], 9*d4726bddSHONG Yifan) 10*d4726bddSHONG Yifan 11*d4726bddSHONG Yifan# See https://docs.bazel.build/versions/master/user-manual.html#workspace_status for more information. 12*d4726bddSHONG Yifangenrule( 13*d4726bddSHONG Yifan name = "generate_rustc_env_file", 14*d4726bddSHONG Yifan outs = ["rustc_env_file"], 15*d4726bddSHONG Yifan cmd = "echo \"CARGO_PKG_VERSION=0.1.0-$$(awk '$$1 == \"BUILD_TIMESTAMP\" {print $$2}' bazel-out/volatile-status.txt)\" > $@", 16*d4726bddSHONG Yifan stamp = True, 17*d4726bddSHONG Yifan) 18