| 17 | } |
| 18 | |
| 19 | fn set_commit_info_for_rustc() { |
| 20 | if !Path::new(".git").exists() { |
| 21 | return; |
| 22 | } |
| 23 | let output = match Command::new("git") |
| 24 | .arg("log") |
| 25 | .arg("-1") |
| 26 | .arg("--date=short") |
| 27 | .arg("--format=%H %h %cd") |
| 28 | .arg("--abbrev=9") |
| 29 | .output() |
| 30 | { |
| 31 | Ok(output) if output.status.success() => output, |
| 32 | _ => return, |
| 33 | }; |
| 34 | let stdout = String::from_utf8(output.stdout).unwrap(); |
| 35 | let mut parts = stdout.split_whitespace(); |
| 36 | let mut next = || parts.next().unwrap(); |
| 37 | println!("cargo:rustc-env=WASMTIME_GIT_HASH={}", next()); |
| 38 | println!( |
| 39 | "cargo:rustc-env=WASMTIME_VERSION_INFO={} ({} {})", |
| 40 | env!("CARGO_PKG_VERSION"), |
| 41 | next(), |
| 42 | next() |
| 43 | ); |
| 44 | } |