forked from cloud-hypervisor/cloud-hypervisor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.rs
More file actions
22 lines (19 loc) · 633 Bytes
/
build.rs
File metadata and controls
22 lines (19 loc) · 633 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright © 2020 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use std::process::Command;
fn main() {
let git_out = Command::new("git")
.args(&["describe", "--dirty"])
.output()
.expect("Expect to get git describe output");
// This println!() has a special behavior, as it will set the environment
// variable BUILT_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=BUILT_VERSION={}",
String::from_utf8(git_out.stdout).unwrap()
);
}