performance-metrics: Add git committer date to the report

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2022-02-15 07:51:44 -08:00
committed by Rob Bradford
parent 1025783973
commit 458ae2c5be
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -27,10 +27,23 @@ fn main() {
}
}
let mut git_committer_date = "".to_string();
if let Ok(git_out) = Command::new("git")
.args(&["show", "-s", "--format=%cd"])
.output()
{
if git_out.status.success() {
if let Ok(git_out_str) = String::from_utf8(git_out.stdout) {
git_committer_date = git_out_str;
}
}
}
// This println!() has a special behavior, as it will set the environment
// variable GIT_human_readable, so that it can be reused from the binary.
// Particularly, this is used from the main.rs to display the exact
// version information.
println!("cargo:rustc-env=GIT_HUMAN_READABLE={}", git_human_readable);
println!("cargo:rustc-env=GIT_REVISION={}", git_revision);
println!("cargo:rustc-env=GIT_COMMITER_DATE={}", git_committer_date);
}