mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
59012ccc6e
Signed-off-by: Omer Faruk Bayram <omer.faruk@sartura.hr>
25 lines
757 B
Rust
25 lines
757 B
Rust
// Copyright © 2020 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
use std::process::Command;
|
|
|
|
fn main() {
|
|
let mut version = "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) {
|
|
version = git_out_str;
|
|
}
|
|
}
|
|
}
|
|
|
|
// This println!() has a special behavior, as it will set the environment
|
|
// variable BUILD_VERSION, so that it can be reused from the binary.
|
|
// Particularly, this is used from src/main.rs to display the exact
|
|
// version.
|
|
println!("cargo:rustc-env=BUILD_VERSION={version}");
|
|
}
|