diff --git a/performance-metrics/Cargo.toml b/performance-metrics/Cargo.toml index a0afab75d..3517b6473 100644 --- a/performance-metrics/Cargo.toml +++ b/performance-metrics/Cargo.toml @@ -3,7 +3,7 @@ name = "performance-metrics" version = "0.1.0" authors = ["The Cloud Hypervisor Authors"] edition = "2021" -build = "build.rs" +build = "../build.rs" [dependencies] argh = "0.1.9" diff --git a/performance-metrics/build.rs b/performance-metrics/build.rs deleted file mode 100644 index 7dcd810af..000000000 --- a/performance-metrics/build.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright © 2020 Intel Corporation -// -// SPDX-License-Identifier: Apache-2.0 -// - -use std::process::Command; - -fn main() { - let mut git_human_readable = "v".to_owned() + env!("CARGO_PKG_VERSION"); - - if let Ok(git_out) = Command::new("git").args(["describe", "--dirty"]).output() { - if git_out.status.success() { - if let Ok(git_out_str) = String::from_utf8(git_out.stdout) { - git_human_readable = 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}"); -} diff --git a/performance-metrics/src/main.rs b/performance-metrics/src/main.rs index d27945d9c..4ea3fe694 100644 --- a/performance-metrics/src/main.rs +++ b/performance-metrics/src/main.rs @@ -654,7 +654,7 @@ fn main() { let opts: Options = argh::from_env(); if opts.version { - println!("{} {}", env!("CARGO_BIN_NAME"), env!("GIT_HUMAN_READABLE")); + println!("{} {}", env!("CARGO_BIN_NAME"), env!("BUILT_VERSION")); return; }