Files
wasmer/lib/cli/build.rs
Yuri Astrakhan f123f69892 chore: inline format args to improve readability
Using this command, fixed format argument inlining to improve readability, and fix a few minor related styling issues like trailing commas in a single line.

```
cargo clippy --all-targets --workspace --exclude wasmer-cli --exclude wasmer-swift -- -D clippy::uninlined_format_args
```
2025-01-22 12:53:01 -05:00

28 lines
758 B
Rust

use std::process::Command;
use chrono::prelude::*;
pub fn main() {
// Set WASMER_GIT_HASH
let git_hash = Command::new("git")
.args(["rev-parse", "HEAD"])
.output()
.ok()
.and_then(|output| String::from_utf8(output.stdout).ok())
.unwrap_or_default();
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH={git_hash}");
if git_hash.len() > 5 {
println!(
"cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT={}",
&git_hash[..7]
);
} else {
println!("cargo:rustc-env=WASMER_BUILD_GIT_HASH_SHORT=???????");
}
let utc: DateTime<Utc> = Utc::now();
let date = utc.format("%Y-%m-%d").to_string();
println!("cargo:rustc-env=WASMER_BUILD_DATE={date}");
}