mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-03-30 00:20:55 +03:00
use shadow-rs instead of executing git describe
this removes git from the build dependencies
This commit is contained in:
22
build.rs
22
build.rs
@@ -1,20 +1,8 @@
|
||||
use std::process::Command;
|
||||
use shadow_rs::ShadowBuilder;
|
||||
|
||||
fn main() {
|
||||
// commit hash
|
||||
let git_describe = Command::new("git")
|
||||
.arg("describe")
|
||||
.arg("--always")
|
||||
.arg("--dirty")
|
||||
.arg("--tags")
|
||||
.output()
|
||||
.map(|output| String::from_utf8(output.stdout).ok())
|
||||
.ok()
|
||||
.flatten()
|
||||
.unwrap_or_else(|| {
|
||||
println!("cargo:warning=Failed to get git describe");
|
||||
String::from("unknown")
|
||||
});
|
||||
let git_describe = git_describe.trim().to_string();
|
||||
println!("cargo::rustc-env=GIT_DESCRIBE={git_describe}");
|
||||
ShadowBuilder::builder()
|
||||
.deny_const(Default::default())
|
||||
.build()
|
||||
.expect("shadow build");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user